]> Some of my projects - localmylist.git/commitdiff
Implement "remove file location" context menu option.
authorAPTX <redacted>
Mon, 17 Aug 2015 19:12:01 +0000 (21:12 +0200)
committerAPTX <redacted>
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 dc0d74f..1c85791 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 6b2f5cb..4c1254c 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 8c7f04e..a1f6525 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;