]> Some of my projects - localmylist.git/commitdiff
Implement "remove file location" context menu option.
authorAPTX <marek321@gmail.com>
Mon, 17 Aug 2015 19:12:01 +0000 (21:12 +0200)
committerAPTX <marek321@gmail.com>
Mon, 17 Aug 2015 19:12:01 +0000 (21:12 +0200)
FileLocationType now responds to insert/update/delete
of file locations in the database.
The Context menu option just needs to trigger the
removal via MyList.

localmylist-management/tabs/dynamicmodeltab.cpp
localmylist/dynamicmodel/types.cpp
localmylist/dynamicmodel/types.h

index dc0d74f06e4dc3071b5e9bcaab4c64eef20a6653..1c8579103acda525488582e62313f579aae7deed 100644 (file)
@@ -264,8 +264,7 @@ void DynamicModelTab::on_myListView_dataRequested(const QModelIndex &index)
 
 void DynamicModelTab::on_myListView_removeFileLocationRequested(int id)
 {
-       Q_UNUSED(id);
-       //myListModel()->removeFileLocation(id);
+       MyList::instance()->database()->removeFileLocation(id);
 }
 
 
index 6b2f5cbeb1608de8c734d1f9cf49f4cfe35a474a..4c1254c6b2a470caadc04ae0ec85ba2b1879ddb5 100644 (file)
@@ -516,6 +516,13 @@ QString FileLocationType::additionalJoins() const
        return "JOIN host h ON (fl.host_id = h.host_id)";
 }
 
+void FileLocationType::registerd()
+{
+       connect(MyList::instance()->database(), SIGNAL(fileLocationInsert(int,int)), this, SLOT(fileLocationAdded(int,int)));
+       connect(MyList::instance()->database(), SIGNAL(fileLocationUpdate(int,int)), this, SLOT(fileLocationUpdated(int,int)));
+       connect(MyList::instance()->database(), SIGNAL(fileLocationDelete(int,int)), this, SLOT(fileLocationDeleted(int,int)));
+}
+
 void FileLocationType::update(Data *data)
 {
        QSqlQuery q = MyList::instance()->database()->prepareOneShot(updateQuery());
index 8c7f04edd811078f6f4d8914485bee8712176d06..a1f652504a34c93ec21f68c34f497b23eab0462d 100644 (file)
@@ -140,6 +140,8 @@ class LOCALMYLISTSHARED_EXPORT FileLocationType : public DataType
        QString additionalColumns() const;
        QString additionalJoins() const override;
 
+       void registerd() override;
+
        void update(Data *data) override;
 
        Data *readEntry(const SqlResultIteratorInterface &it) override;