diff --git a/resources/text/CHANGELOG b/resources/text/CHANGELOG
index 2bee8669b..10772953e 100644
--- a/resources/text/CHANGELOG
+++ b/resources/text/CHANGELOG
@@ -7,6 +7,8 @@ Added:
Fixed:
+- Keyboard shorcuts and toolbar editors now have alphabetically sorted actions. Toolbar editor switched from drag/drop to buttons. (issue
+#110)
- New constructs on source code level.
- Many minor fixes, mainly code cleanup and refactoring.
diff --git a/src/core/feeddownloader.cpp b/src/core/feeddownloader.cpp
index 761295f8f..09f7fca8c 100644
--- a/src/core/feeddownloader.cpp
+++ b/src/core/feeddownloader.cpp
@@ -23,30 +23,20 @@
#include
-FeedDownloader::FeedDownloader(QObject *parent) : QObject(parent), m_updateAbortionRequested(false) {
+FeedDownloader::FeedDownloader(QObject *parent) : QObject(parent) {
}
FeedDownloader::~FeedDownloader() {
qDebug("Destroying FeedDownloader instance.");
}
-void FeedDownloader::updateFeeds(const QList &feeds) {
+void FeedDownloader::updateFeeds(const QList &feeds) {
qDebug().nospace() << "Performing feed updates in thread: \'" << QThread::currentThreadId() << "\'.";
- if (m_updateAbortionRequested) {
- m_updateAbortionRequested = false;
- }
-
// Job starts now.
emit started();
for (int i = 0, total = feeds.size(); i < total; i++) {
- if (m_updateAbortionRequested) {
- m_updateAbortionRequested = false;
- qWarning("Interruption of feeds update process was requested. Interrupting it now.");
- break;
- }
-
feeds.at(i)->update();
qDebug("Made progress in feed updates: %d/%d (id of feed is %d).", i + 1, total, feeds.at(i)->id());
emit progress(feeds.at(i), i + 1, total);
@@ -60,7 +50,3 @@ void FeedDownloader::updateFeeds(const QList &feeds) {
// can eventually quit.
emit finished();
}
-
-void FeedDownloader::abortOngoingUpdate() {
- m_updateAbortionRequested = true;
-}
diff --git a/src/core/feeddownloader.h b/src/core/feeddownloader.h
index 78ef9058d..365cb4012 100644
--- a/src/core/feeddownloader.h
+++ b/src/core/feeddownloader.h
@@ -41,9 +41,6 @@ class FeedDownloader : public QObject {
// Appropriate signals are emitted.
void updateFeeds(const QList &feeds);
- // Aborts ongoing message if there is any.
- void abortOngoingUpdate();
-
signals:
// Emitted if feed updates started.
void started();
@@ -57,9 +54,6 @@ class FeedDownloader : public QObject {
// and "total" number indicates total number of feeds
// which were in the initial queue.
void progress(FeedsModelFeed *feed, int current, int total);
-
- private:
- bool m_updateAbortionRequested;
};
#endif // FEEDDOWNLOADER_H
diff --git a/src/gui/feedmessageviewer.cpp b/src/gui/feedmessageviewer.cpp
index ca85d669d..b8c3c96ce 100755
--- a/src/gui/feedmessageviewer.cpp
+++ b/src/gui/feedmessageviewer.cpp
@@ -123,7 +123,6 @@ void FeedMessageViewer::quit() {
m_feedsView->quit();
qDebug("Quitting feed downloader thread.");
- m_feedDownloader->abortOngoingUpdate();
m_feedDownloaderThread->quit();
m_feedDownloaderThread->wait();
diff --git a/src/gui/toolbareditor.cpp b/src/gui/toolbareditor.cpp
index 3bbc669f4..62b2e6f0c 100755
--- a/src/gui/toolbareditor.cpp
+++ b/src/gui/toolbareditor.cpp
@@ -20,6 +20,8 @@
#include "gui/basetoolbar.h"
#include "gui/formmain.h"
+#include
+
ToolBarEditor::ToolBarEditor(QWidget *parent)
: QWidget(parent), m_ui(new Ui::ToolBarEditor) {
@@ -37,6 +39,10 @@ ToolBarEditor::ToolBarEditor(QWidget *parent)
connect(m_ui->m_listAvailableActions, SIGNAL(itemSelectionChanged()), this, SLOT(updateActionsAvailability()));
connect(m_ui->m_listActivatedActions, SIGNAL(itemSelectionChanged()), this, SLOT(updateActionsAvailability()));
+ connect(m_ui->m_listActivatedActions, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(deleteSelectedAction()));
+ connect(m_ui->m_listAvailableActions, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(addSelectedAction()));
+
+ m_ui->m_listActivatedActions->installEventFilter(this);
}
ToolBarEditor::~ToolBarEditor() {
@@ -50,9 +56,7 @@ void ToolBarEditor::loadFromToolBar(BaseToolBar *tool_bar) {
QList available_actions = m_toolBar->availableActions();
foreach (QAction *action, activated_actions) {
- QListWidgetItem *action_item = new QListWidgetItem(action->icon(),
- action->text().replace('&', ""),
- m_ui->m_listActivatedActions);
+ QListWidgetItem *action_item = new QListWidgetItem(action->icon(), action->text().replace('&', ""), m_ui->m_listActivatedActions);
if (action->isSeparator()) {
action_item->setData(Qt::UserRole, SEPARATOR_ACTION_NAME);
@@ -73,9 +77,7 @@ void ToolBarEditor::loadFromToolBar(BaseToolBar *tool_bar) {
foreach (QAction *action, available_actions) {
if (!activated_actions.contains(action)) {
- QListWidgetItem *action_item = new QListWidgetItem(action->icon(),
- action->text().replace('&', ""),
- m_ui->m_listAvailableActions);
+ QListWidgetItem *action_item = new QListWidgetItem(action->icon(), action->text().replace('&', ""), m_ui->m_listAvailableActions);
if (action->isSeparator()) {
action_item->setData(Qt::UserRole, SEPARATOR_ACTION_NAME);
@@ -96,7 +98,8 @@ void ToolBarEditor::loadFromToolBar(BaseToolBar *tool_bar) {
}
m_ui->m_listAvailableActions->sortItems(Qt::AscendingOrder);
- updateActionsAvailability();
+ m_ui->m_listAvailableActions->setCurrentRow(0);
+ m_ui->m_listActivatedActions->setCurrentRow(m_ui->m_listActivatedActions->count() >= 0 ? 0 : -1);
}
void ToolBarEditor::saveToolBar() {
@@ -109,6 +112,19 @@ void ToolBarEditor::saveToolBar() {
m_toolBar->saveChangeableActions(action_names);
}
+bool ToolBarEditor::eventFilter(QObject *object, QEvent *event) {
+ if (event->type() == QEvent::KeyPress) {
+ QKeyEvent *key_event = static_cast(event);
+
+ if (key_event->key() == Qt::Key_Delete) {
+ deleteSelectedAction();
+ return true;
+ }
+ }
+
+ return false;
+}
+
void ToolBarEditor::updateActionsAvailability() {
m_ui->m_btnDeleteAllActions->setEnabled(m_ui->m_listActivatedActions->count() > 0);
m_ui->m_btnDeleteSelectedAction->setEnabled(m_ui->m_listActivatedActions->selectedItems().size() == 1);
diff --git a/src/gui/toolbareditor.h b/src/gui/toolbareditor.h
index 78aa60a2c..16a2e6f82 100644
--- a/src/gui/toolbareditor.h
+++ b/src/gui/toolbareditor.h
@@ -49,6 +49,9 @@ class ToolBarEditor : public QWidget {
return m_ui->m_listAvailableActions;
}
+ protected:
+ bool eventFilter(QObject *object, QEvent *event);
+
private slots:
void updateActionsAvailability();