/***************************************************************************
- * Copyright (C) 2005-2015 by the Quassel Project *
+ * Copyright (C) 2005-2016 by the Quassel Project *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
#include "legacysystemtray.h"
#include "msgprocessorstatuswidget.h"
#include "nicklistwidget.h"
+#include "passwordchangedlg.h"
#include "qtuiapplication.h"
#include "qtuimessageprocessor.h"
#include "qtuisettings.h"
#include "verticaldock.h"
#ifndef HAVE_KDE
+# ifdef HAVE_QTMULTIMEDIA
+# include "qtmultimedianotificationbackend.h"
+# endif
# 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
#include "settingspages/bufferviewsettingspage.h"
#include "settingspages/chatmonitorsettingspage.h"
#include "settingspages/chatviewsettingspage.h"
+#include "settingspages/chatviewcolorsettingspage.h"
#include "settingspages/connectionsettingspage.h"
#include "settingspages/coreaccountsettingspage.h"
#include "settingspages/coreconnectionsettingspage.h"
# include "settingspages/shortcutssettingspage.h"
#endif
+#ifdef HAVE_SONNET
+# include "settingspages/sonnetsettingspage.h"
+#endif
+
+
MainWin::MainWin(QWidget *parent)
#ifdef HAVE_KDE
: KMainWindow(parent), _kHelpMenu(new KHelpMenu(this)),
connect(Client::coreConnection(), SIGNAL(handleSslErrors(const QSslSocket *, bool *, bool *)), SLOT(handleSslErrors(const QSslSocket *, bool *, bool *)));
#endif
- connect(this, SIGNAL(changePassword(QString)), Client::instance(), SLOT(changePassword(QString)));
-
// Setup Dock Areas
setDockNestingEnabled(true);
setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea);
setupHotList();
#ifndef HAVE_KDE
+# ifdef HAVE_QTMULTIMEDIA
+ QtUi::registerNotificationBackend(new QtMultimediaNotificationBackend(this));
+# 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
show();
}
+QMenu *MainWin::createPopupMenu()
+{
+ QMenu *popupMenu = QMainWindow::createPopupMenu();
+ popupMenu->addSeparator();
+ ActionCollection *coll = QtUi::actionCollection("General");
+ popupMenu->addAction(coll->action("ToggleMenuBar"));
+ return popupMenu;
+}
+
void MainWin::updateIcon()
{
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("ShowAwayLog", new Action(tr("Show Away Log"), coll,
this, SLOT(showAwayLog())));
coll->addAction("ToggleMenuBar", new Action(QIcon::fromTheme("show-menu"), tr("Show &Menubar"), coll,
- 0, 0, QKeySequence(Qt::CTRL + Qt::Key_M)))->setCheckable(true);
+ 0, 0))->setCheckable(true);
coll->addAction("ToggleStatusBar", new Action(tr("Show Status &Bar"), coll,
0, 0))->setCheckable(true);
#endif
coll->addAction("ConfigureQuassel", configureQuasselAct);
- QAction *changePasswordAct = new Action(QIcon::fromTheme("dialog-password"), tr("&Change password..."), coll,
- this, SLOT(showChangePasswordDialog()));
- coll->addAction("ChangePassword", changePasswordAct);
-
// Help
QAction *aboutQuasselAct = new Action(QIcon(":/icons/quassel.png"), tr("&About Quassel"), coll,
this, SLOT(showAboutDlg()));
coll->addAction("JumpHotBuffer", new Action(tr("Jump to hot chat"), coll,
this, SLOT(on_jumpHotBuffer_triggered()), QKeySequence(Qt::META + Qt::Key_A)));
+ coll->addAction("ActivateBufferFilter", new Action(tr("Activate the buffer search"), coll,
+ this, SLOT(on_bufferSearch_triggered()), QKeySequence(Qt::CTRL + Qt::Key_S)));
+
// Jump keys
#ifdef Q_OS_MAC
const int bindModifier = Qt::ControlModifier | Qt::AltModifier;
_fileMenu = menuBar()->addMenu(tr("&File"));
static const QStringList coreActions = QStringList()
- << "ConnectCore" << "DisconnectCore" << "CoreInfo";
+ << "ConnectCore" << "DisconnectCore" << "ChangePassword" << "CoreInfo";
QAction *coreAction;
foreach(QString actionName, coreActions) {
#else
_settingsMenu->addAction(coll->action("ConfigureShortcuts"));
#endif
- _settingsMenu->addAction(coll->action("ChangePassword"));
_settingsMenu->addAction(coll->action("ConfigureQuassel"));
if (_activeBufferViewIndex < 0 || _activeBufferViewIndex >= _bufferViews.count())
return 0;
BufferViewDock *dock = _bufferViews.at(_activeBufferViewIndex);
- return dock->isActive() ? qobject_cast<BufferView *>(dock->widget()) : 0;
+ return dock->isActive() ? dock->bufferView() : 0;
}
if (bufferViewId < 0)
return;
- BufferView *current = activeBufferView();
- if (current) {
- qobject_cast<BufferViewDock *>(current->parent())->setActive(false);
+ if (_activeBufferViewIndex >= 0 && _activeBufferViewIndex < _bufferViews.count()) {
+ _bufferViews[_activeBufferViewIndex]->setActive(false);
_activeBufferViewIndex = -1;
}
nextBufferView(); // fallback
}
-void MainWin::showChangePasswordDialog()
+
+void MainWin::showPasswordChangeDlg()
{
- bool ok;
- QString newPassword = QInputDialog::getText(this, tr("Set new password"), tr("New password:"), QLineEdit::Password, QString(), &ok);
- if (ok && !newPassword.isEmpty()) {
- emit changePassword(newPassword);
+ 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();
- if (current)
- qobject_cast<BufferViewDock *>(current->parent())->setActive(false);
+ if (_activeBufferViewIndex >= 0 && _activeBufferViewIndex < _bufferViews.count()) {
+ _bufferViews[_activeBufferViewIndex]->setActive(false);
+ }
if (!_bufferViews.count())
return;
// attach the NickListWidget to the BufferModel and the default selection
_nickListWidget->setModel(Client::bufferModel());
_nickListWidget->setSelectionModel(Client::bufferModel()->standardSelectionModel());
+
+ _nickListWidget->setVisible(false);
}
connect(Client::bufferViewManager(), SIGNAL(bufferViewConfigDeleted(int)), this, SLOT(removeBufferView(int)));
connect(Client::bufferViewManager(), SIGNAL(initDone()), this, SLOT(loadLayout()));
- connect(Client::transferManager(), SIGNAL(transferAdded(const ClientTransfer*)), SLOT(showNewTransferDlg(const ClientTransfer*)));
+ connect(Client::transferManager(), SIGNAL(transferAdded(QUuid)), SLOT(showNewTransferDlg(QUuid)));
setConnectedState();
}
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);
}
//Category: Interface
dlg->registerSettingsPage(new AppearanceSettingsPage(dlg));
dlg->registerSettingsPage(new ChatViewSettingsPage(dlg));
+ dlg->registerSettingsPage(new ChatViewColorSettingsPage(dlg));
dlg->registerSettingsPage(new ChatMonitorSettingsPage(dlg));
dlg->registerSettingsPage(new ItemViewSettingsPage(dlg));
dlg->registerSettingsPage(new BufferViewSettingsPage(dlg));
dlg->registerSettingsPage(new InputWidgetSettingsPage(dlg));
dlg->registerSettingsPage(new TopicWidgetSettingsPage(dlg));
+#ifdef HAVE_SONNET
+ dlg->registerSettingsPage(new SonnetSettingsPage(dlg));
+#endif
dlg->registerSettingsPage(new HighlightSettingsPage(dlg));
dlg->registerSettingsPage(new NotificationsSettingsPage(dlg));
dlg->registerSettingsPage(new BacklogSettingsPage(dlg));
}
-void MainWin::showNewTransferDlg(const ClientTransfer *transfer)
+void MainWin::showNewTransferDlg(const QUuid &transferId)
{
- ReceiveFileDlg *dlg = new ReceiveFileDlg(transfer, this);
- dlg->show();
+ auto transfer = Client::transferManager()->transfer(transferId);
+ if (transfer) {
+ ReceiveFileDlg *dlg = new ReceiveFileDlg(transfer, this);
+ dlg->show();
+ }
+ else {
+ qWarning() << "Unknown transfer ID" << transferId;
+ }
}
Client::bufferModel()->switchToBuffer(_bufferHotList->hottestBuffer());
}
+void MainWin::on_bufferSearch_triggered()
+{
+ if (_activeBufferViewIndex < 0 || _activeBufferViewIndex >= _bufferViews.count()) {
+ qWarning() << "Tried to activate filter on invalid bufferview:" << _activeBufferViewIndex;
+ return;
+ }
+
+ _bufferViews[_activeBufferViewIndex]->activateFilter();
+}
+
void MainWin::onJumpKey()
{