#include "settingspages/notificationssettingspage.h"
#include "settingspages/topicwidgetsettingspage.h"
+#ifndef HAVE_KDE
+# include "settingspages/shortcutssettingspage.h"
+#endif
+
MainWin::MainWin(QWidget *parent)
#ifdef HAVE_KDE
: KMainWindow(parent),
QtUi::registerNotificationBackend(new IndicatorNotificationBackend(this));
#endif
+ // we assume that at this point, all configurable actions are defined!
+ QtUi::loadShortcuts();
+
connect(bufferWidget(), SIGNAL(currentChanged(BufferId)), SLOT(currentBufferChanged(BufferId)));
setDisconnectedState(); // Disable menus and stuff
0, 0))->setCheckable(true);
// Settings
+ coll->addAction("ConfigureShortcuts", new Action(SmallIcon("configure-shortcuts"), tr("Configure &Shortcuts..."), coll,
+ this, SLOT(showShortcutsDlg())));
coll->addAction("ConfigureQuassel", new Action(SmallIcon("configure"), tr("&Configure Quassel..."), coll,
this, SLOT(showSettingsDlg()), QKeySequence(Qt::Key_F7)));
#ifdef HAVE_KDE
_settingsMenu->addAction(KStandardAction::configureNotifications(this, SLOT(showNotificationsDlg()), this));
_settingsMenu->addAction(KStandardAction::keyBindings(this, SLOT(showShortcutsDlg()), this));
+#else
+ _settingsMenu->addAction(coll->action("ConfigureShortcuts"));
#endif
_settingsMenu->addAction(coll->action("ConfigureQuassel"));
}
void MainWin::bufferViewToggled(bool enabled) {
+ if(!enabled && !isVisible()) {
+ // hiding the mainwindow triggers a toggle of the bufferview (which pretty much sucks big time)
+ // since this isn't our fault and we can't do anything about it, we suppress the resulting calls
+ return;
+ }
QAction *action = qobject_cast<QAction *>(sender());
Q_ASSERT(action);
BufferViewDock *dock = qobject_cast<BufferViewDock *>(action->parent());
if(enabled) {
Client::bufferViewOverlay()->addView(dock->bufferViewId());
- BufferViewConfig *config = dock->config();
- if(config && config->isInitialized()) {
- BufferIdList buffers;
- if(config->networkId().isValid()) {
- foreach(BufferId bufferId, config->bufferList()) {
- if(Client::networkModel()->networkId(bufferId) == config->networkId())
- buffers << bufferId;
- }
- foreach(BufferId bufferId, config->temporarilyRemovedBuffers().toList()) {
- if(Client::networkModel()->networkId(bufferId) == config->networkId())
- buffers << bufferId;
- }
- } else {
- buffers = BufferIdList::fromSet(config->bufferList().toSet() + config->temporarilyRemovedBuffers());
- }
- Client::backlogManager()->checkForBacklog(buffers);
- }
} else {
Client::bufferViewOverlay()->removeView(dock->bufferViewId());
}
if(dock && actionData.toInt() != -1) {
removeAction(action);
_bufferViews.removeAll(dock);
- Client::bufferViewOverlay()->removeView(dock->bufferViewId());
dock->deleteLater();
}
}
AboutDlg(this).exec();
}
-#ifdef HAVE_KDE
void MainWin::showShortcutsDlg() {
+#ifdef HAVE_KDE
KShortcutsDialog::configure(QtUi::actionCollection("General"), KShortcutsEditor::LetterShortcutsDisallowed);
-}
+#else
+ SettingsPageDlg dlg(new ShortcutsSettingsPage(QtUi::actionCollections(), this), this);
+ dlg.exec();
#endif
+}
/********************************************************************************************************/