#include <QMessageBox>
#include <QStatusBar>
#include <QToolBar>
+#include <QInputDialog>
#ifdef HAVE_KDE4
-# include <KAction>
-# include <KActionCollection>
# include <KHelpMenu>
# include <KMenuBar>
# include <KShortcutsDialog>
# include <KStatusBar>
# include <KToggleFullScreenAction>
# include <KToolBar>
-# include <KWindowSystem>
#endif
#ifdef HAVE_KF5
# include <KConfigWidgets/KStandardAction>
# include <KXmlGui/KHelpMenu>
# include <KXmlGui/KShortcutsDialog>
+# include <KXmlGui/KToolBar>
+# include <KWidgetsAddons/KToggleFullScreenAction>
#endif
#ifdef Q_WS_X11
#include "legacysystemtray.h"
#include "msgprocessorstatuswidget.h"
#include "nicklistwidget.h"
+#include "passwordchangedlg.h"
#include "qtuiapplication.h"
#include "qtuimessageprocessor.h"
#include "qtuisettings.h"
# ifdef HAVE_PHONON
# include "phononnotificationbackend.h"
# endif
-# ifdef HAVE_LIBSNORE
-# include "snorenotificationbackend.h"
-# endif
# include "systraynotificationbackend.h"
# include "taskbarnotificationbackend.h"
#else /* HAVE_KDE */
# include "knotificationbackend.h"
#endif /* HAVE_KDE */
+
+#ifdef HAVE_LIBSNORE
+# include "snorenotificationbackend.h"
+#endif
+
#ifdef HAVE_SSL
# include "sslinfodlg.h"
#endif
# ifdef HAVE_PHONON
QtUi::registerNotificationBackend(new PhononNotificationBackend(this));
# endif
-# ifdef HAVE_LIBSNORE
- QtUi::registerNotificationBackend(new SnoreNotificationBackend(this));
-# elif !defined(QT_NO_SYSTEMTRAYICON)
- QtUi::registerNotificationBackend(new SystrayNotificationBackend(this));
-# endif
-
QtUi::registerNotificationBackend(new TaskbarNotificationBackend(this));
-
#else /* HAVE_KDE */
QtUi::registerNotificationBackend(new KNotificationBackend(this));
#endif /* HAVE_KDE */
+
+#ifdef HAVE_LIBSNORE
+ QtUi::registerNotificationBackend(new SnoreNotificationBackend(this));
+#elif !defined(QT_NO_SYSTEMTRAYICON) && !defined(HAVE_KDE)
+ QtUi::registerNotificationBackend(new SystrayNotificationBackend(this));
+#endif
+
#ifdef HAVE_INDICATEQT
QtUi::registerNotificationBackend(new IndicatorNotificationBackend(this));
#endif
this, SLOT(showCoreConnectionDlg())));
coll->addAction("DisconnectCore", new Action(QIcon::fromTheme("network-disconnect"), tr("&Disconnect from Core"), coll,
Client::instance(), SLOT(disconnectFromCore())));
+ coll->addAction("ChangePassword", new Action(QIcon::fromTheme("dialog-password"), tr("Change &Password..."), coll,
+ this, SLOT(showPasswordChangeDlg())));
coll->addAction("CoreInfo", new Action(QIcon::fromTheme("help-about"), tr("Core &Info..."), coll,
this, SLOT(showCoreInfoDlg())));
coll->addAction("ConfigureNetworks", new Action(QIcon::fromTheme("configure"), tr("Configure &Networks..."), coll,
coll->addAction("ToggleStatusBar", new Action(tr("Show Status &Bar"), coll,
0, 0))->setCheckable(true);
-#ifdef HAVE_KDE4
- QAction *fullScreenAct = KStandardAction::fullScreen(this, SLOT(onFullScreenToggled()), this, coll);
+#ifdef HAVE_KDE
+ _fullScreenAction = KStandardAction::fullScreen(this, SLOT(onFullScreenToggled()), this, coll);
#else
- QAction *fullScreenAct = new Action(QIcon::fromTheme("view-fullscreen"), tr("&Full Screen Mode"), coll,
+ _fullScreenAction = new Action(QIcon::fromTheme("view-fullscreen"), tr("&Full Screen Mode"), coll,
this, SLOT(onFullScreenToggled()), QKeySequence(Qt::Key_F11));
- fullScreenAct->setCheckable(true);
+ _fullScreenAction->setCheckable(true);
+ coll->addAction("ToggleFullScreen", _fullScreenAction);
#endif
- coll->addAction("ToggleFullScreen", fullScreenAct);
// Settings
QAction *configureShortcutsAct = new Action(QIcon::fromTheme("configure-shortcuts"), tr("Configure &Shortcuts..."), coll,
_fileMenu = menuBar()->addMenu(tr("&File"));
static const QStringList coreActions = QStringList()
- << "ConnectCore" << "DisconnectCore" << "CoreInfo";
+ << "ConnectCore" << "DisconnectCore" << "ChangePassword" << "CoreInfo";
QAction *coreAction;
foreach(QString actionName, coreActions) {
#endif
_settingsMenu->addAction(coll->action("ConfigureQuassel"));
+
_helpMenu = menuBar()->addMenu(tr("&Help"));
_helpMenu->addAction(coll->action("AboutQuassel"));
}
+void MainWin::showPasswordChangeDlg()
+{
+ if((Client::coreFeatures() & Quassel::PasswordChange)) {
+ PasswordChangeDlg dlg(this);
+ dlg.exec();
+ }
+ else {
+ QMessageBox box(QMessageBox::Warning, tr("Feature Not Supported"),
+ tr("<b>Your Quassel Core does not support this feature</b>"),
+ QMessageBox::Ok, this);
+ box.setInformativeText(tr("You need a Quassel Core v0.12.0 or newer in order to be able to remotely change your password."));
+ box.exec();
+ }
+}
+
+
void MainWin::changeActiveBufferView(bool backwards)
{
BufferView *current = activeBufferView();
// attach the NickListWidget to the BufferModel and the default selection
_nickListWidget->setModel(Client::bufferModel());
_nickListWidget->setSelectionModel(Client::bufferModel()->standardSelectionModel());
+
+ _nickListWidget->setVisible(false);
}
void MainWin::setupViewMenuTail()
{
_viewMenu->addSeparator();
- _viewMenu->addAction(QtUi::actionCollection("General")->action("ToggleFullScreen"));
+ _viewMenu->addAction(_fullScreenAction);
}
setUnifiedTitleAndToolBarOnMac(true);
#endif
-#ifdef HAVE_KDE4
+#ifdef HAVE_KDE
_mainToolBar = new KToolBar("MainToolBar", this, Qt::TopToolBarArea, false, true, true);
#else
_mainToolBar = new QToolBar(this);
coll->action("ConnectCore")->setEnabled(false);
coll->action("DisconnectCore")->setEnabled(true);
+ coll->action("ChangePassword")->setEnabled(true);
coll->action("CoreInfo")->setEnabled(true);
foreach(QAction *action, _fileMenu->actions()) {
_layoutLoaded = true;
return;
}
-
+ _nickListWidget->setVisible(true);
restoreState(state, accountId);
int bufferViewId = s.value(QString("ActiveBufferView-%1").arg(accountId), -1).toInt();
if (bufferViewId >= 0)
coll->action("ConnectCore")->setEnabled(true);
coll->action("DisconnectCore")->setEnabled(false);
coll->action("CoreInfo")->setEnabled(false);
+ coll->action("ChangePassword")->setEnabled(false);
//_viewMenu->setEnabled(false);
statusBar()->showMessage(tr("Not connected to core."));
if (_msgProcessorStatusWidget)
_msgProcessorStatusWidget->setProgress(0, 0);
updateIcon();
systemTray()->setState(SystemTray::Passive);
+ _nickListWidget->setVisible(false);
}
// Relying on QWidget::isFullScreen is discouraged, see the KToggleFullScreenAction docs
// Also, one should not use showFullScreen() or showNormal(), as those reset all other window flags
- QAction *action = QtUi::actionCollection("General")->action("ToggleFullScreen");
- if (!action)
- return;
-
-#ifdef HAVE_KDE4
- KToggleFullScreenAction *kAct = static_cast<KToggleFullScreenAction *>(action);
- kAct->setFullScreen(this, kAct->isChecked());
+#ifdef HAVE_KDE
+ static_cast<KToggleFullScreenAction*>(_fullScreenAction)->setFullScreen(this, _fullScreenAction->isChecked());
#else
- if (action->isChecked())
+ if (_fullScreenAction->isChecked())
setWindowState(windowState() | Qt::WindowFullScreen);
else
setWindowState(windowState() & ~Qt::WindowFullScreen);