diff options
| author | LostDragonist <lost.dragonist@gmail.com> | 2018-08-16 13:55:32 -0500 |
|---|---|---|
| committer | LostDragonist <lost.dragonist@gmail.com> | 2018-08-16 13:58:44 -0500 |
| commit | 43b2df9077db98475af6ab613cf7eaf301f84879 (patch) | |
| tree | f38dc6548664e986dfd2cfb3149e5a19da6fcac2 /src | |
| parent | 79b2e52a58d711df53a125b1e3f510b2c2ebf8ff (diff) | |
Add "enable/disable selected" to plugin list context menu
Diffstat (limited to 'src')
| -rw-r--r-- | src/mainwindow.cpp | 18 | ||||
| -rw-r--r-- | src/mainwindow.h | 4 | ||||
| -rw-r--r-- | src/organizer_en.ts | 5 | ||||
| -rw-r--r-- | src/pluginlist.cpp | 41 | ||||
| -rw-r--r-- | src/pluginlist.h | 10 |
5 files changed, 77 insertions, 1 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index e22fe07f..d638e988 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -4170,6 +4170,19 @@ void MainWindow::unhideFile() }
}
+
+void MainWindow::enableSelectedPlugins_clicked()
+{
+ m_OrganizerCore.pluginList()->enableSelected(ui->espList->selectionModel());
+}
+
+
+void MainWindow::disableSelectedPlugins_clicked()
+{
+ m_OrganizerCore.pluginList()->disableSelected(ui->espList->selectionModel());
+}
+
+
void MainWindow::previewDataFile()
{
QString fileName = QDir::fromNativeSeparators(m_ContextItem->data(0, Qt::UserRole).toString());
@@ -4761,6 +4774,11 @@ void MainWindow::on_espList_customContextMenuRequested(const QPoint &pos) m_ContextRow = m_PluginListSortProxy->mapToSource(ui->espList->indexAt(pos)).row();
QMenu menu;
+ menu.addAction(tr("Enable selected"), this, SLOT(enableSelectedPlugins_clicked()));
+ menu.addAction(tr("Disable selected"), this, SLOT(disableSelectedPlugins_clicked()));
+
+ menu.addSeparator();
+
menu.addAction(tr("Enable all"), m_OrganizerCore.pluginList(), SLOT(enableAll()));
menu.addAction(tr("Disable all"), m_OrganizerCore.pluginList(), SLOT(disableAll()));
diff --git a/src/mainwindow.h b/src/mainwindow.h index 6cf83301..085126f7 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -428,6 +428,10 @@ private slots: void hideFile();
void unhideFile();
+ // pluginlist context menu
+ void enableSelectedPlugins_clicked();
+ void disableSelectedPlugins_clicked();
+
void linkToolbar();
void linkDesktop();
void linkMenu();
diff --git a/src/organizer_en.ts b/src/organizer_en.ts index 90311b95..f96ca5cd 100644 --- a/src/organizer_en.ts +++ b/src/organizer_en.ts @@ -2565,6 +2565,7 @@ You can also use online editors and converters instead.</source> </message> <message> <location filename="mainwindow.cpp" line="3565"/> + <location filename="mainwindow.cpp" line="3645"/> <source>Open in Explorer</source> <translation type="unfinished"></translation> </message> @@ -2660,8 +2661,10 @@ You can also use online editors and converters instead.</source> <translation type="unfinished"></translation> </message> <message> + <location filename="mainwindow.cpp" line="3565"/> <location filename="mainwindow.cpp" line="3645"/> - <source>Open in explorer</source> + <source>Open in Explorer</source> + <oldsource>Open in explorer</oldsource> <translation type="unfinished"></translation> </message> <message> diff --git a/src/pluginlist.cpp b/src/pluginlist.cpp index 323cd98f..18e40a6e 100644 --- a/src/pluginlist.cpp +++ b/src/pluginlist.cpp @@ -289,6 +289,47 @@ void PluginList::enableESP(const QString &name, bool enable) }
}
+void PluginList::enableSelected(const QItemSelectionModel *selectionModel)
+{
+ if (selectionModel->hasSelection()){
+ bool dirty = false;
+ for (auto row : selectionModel->selectedRows(COL_PRIORITY)) {
+ int rowPriority = row.data().toInt();
+ for (int i = 0; i < m_ESPs.size(); i++) {
+ if (m_ESPs[i].m_Priority == rowPriority) {
+ if (!m_ESPs[i].m_Enabled) {
+ m_ESPs[i].m_Enabled = true;
+ dirty = true;
+ }
+
+ break;
+ }
+ }
+ }
+ if (dirty) emit writePluginsList();
+ }
+}
+
+void PluginList::disableSelected(const QItemSelectionModel *selectionModel)
+{
+ if (selectionModel->hasSelection()){
+ bool dirty = false;
+ for (auto row : selectionModel->selectedRows(COL_PRIORITY)) {
+ int rowPriority = row.data().toInt();
+ for (int i = 0; i < m_ESPs.size(); i++) {
+ if (m_ESPs[i].m_Priority == rowPriority) {
+ if (!m_ESPs[i].m_ForceEnabled && m_ESPs[i].m_Enabled) {
+ m_ESPs[i].m_Enabled = false;
+ dirty = true;
+ }
+ break;
+ }
+ }
+ }
+ if (dirty) emit writePluginsList();
+ }
+}
+
void PluginList::enableAll()
{
diff --git a/src/pluginlist.h b/src/pluginlist.h index b8e35c32..03d6426a 100644 --- a/src/pluginlist.h +++ b/src/pluginlist.h @@ -245,6 +245,16 @@ public: // implementation of the QAbstractTableModel interface public slots:
/**
+ * @brief enables selected plugins
+ **/
+ void enableSelected(const QItemSelectionModel *selectionModel);
+
+ /**
+ * @brief disables selected plugins
+ **/
+ void disableSelected(const QItemSelectionModel *selectionModel);
+
+ /**
* @brief enables ALL plugins
**/
void enableAll();
|
