156
159
connect(GraphicalUi::contextMenuActionProvider(), SIGNAL(showChannelList(NetworkId)), SLOT(showChannelList(NetworkId)));
157
160
connect(GraphicalUi::contextMenuActionProvider(), SIGNAL(showIgnoreList(QString)), SLOT(showIgnoreList(QString)));
162
connect(Client::coreConnection(), SIGNAL(startCoreSetup(QVariantList)), SLOT(showCoreConfigWizard(QVariantList)));
163
connect(Client::coreConnection(), SIGNAL(connectionErrorPopup(QString)), SLOT(handleCoreConnectionError(QString)));
164
connect(Client::coreConnection(), SIGNAL(userAuthenticationRequired(CoreAccount *, bool *, QString)), SLOT(userAuthenticationRequired(CoreAccount *, bool *, QString)));
165
connect(Client::coreConnection(), SIGNAL(handleNoSslInClient(bool*)), SLOT(handleNoSslInClient(bool *)));
166
connect(Client::coreConnection(), SIGNAL(handleNoSslInCore(bool*)), SLOT(handleNoSslInCore(bool *)));
168
connect(Client::coreConnection(), SIGNAL(handleSslErrors(const QSslSocket *, bool *, bool *)), SLOT(handleSslErrors(const QSslSocket *, bool *, bool *)));
159
171
// Setup Dock Areas
160
172
setDockNestingEnabled(true);
161
173
setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea);
311
325
connect(lockAct, SIGNAL(toggled(bool)), SLOT(on_actionLockLayout_toggled(bool)));
313
327
coll->addAction("ToggleSearchBar", new Action(SmallIcon("edit-find"), tr("Show &Search Bar"), coll,
314
0, 0, QKeySequence::Find))->setCheckable(true);
328
0, 0, QKeySequence::Find))->setCheckable(true);
315
329
coll->addAction("ShowAwayLog", new Action(tr("Show Away Log"), coll,
316
this, SLOT(showAwayLog())));
330
this, SLOT(showAwayLog())));
317
331
coll->addAction("ToggleMenuBar", new Action(SmallIcon("show-menu"), tr("Show &Menubar"), coll,
318
332
0, 0, tr("Ctrl+M")))->setCheckable(true);
598
613
_bufferWidget->setFocusProxy(_inputWidget);
600
615
_inputWidget->inputLine()->installEventFilter(_bufferWidget);
617
connect(_topicWidget, SIGNAL(switchedPlain()), _bufferWidget, SLOT(setFocus()));
603
620
void MainWin::setupTopicWidget() {
604
621
VerticalDock *dock = new VerticalDock(tr("Topic"), this);
605
622
dock->setObjectName("TopicDock");
606
TopicWidget *topicwidget = new TopicWidget(dock);
608
dock->setWidget(topicwidget);
610
topicwidget->setModel(Client::bufferModel());
611
topicwidget->setSelectionModel(Client::bufferModel()->standardSelectionModel());
623
_topicWidget = new TopicWidget(dock);
625
dock->setWidget(_topicWidget);
627
_topicWidget->setModel(Client::bufferModel());
628
_topicWidget->setSelectionModel(Client::bufferModel()->standardSelectionModel());
613
630
addDockWidget(Qt::TopDockWidgetArea, dock, Qt::Vertical);
712
731
action->setVisible(!Client::internalCore());
715
disconnect(Client::backlogManager(), SIGNAL(updateProgress(int, int)), msgProcessorStatusWidget, SLOT(setProgress(int, int)));
734
disconnect(Client::backlogManager(), SIGNAL(updateProgress(int, int)), _msgProcessorStatusWidget, SLOT(setProgress(int, int)));
716
735
disconnect(Client::backlogManager(), SIGNAL(messagesRequested(const QString &)), this, SLOT(showStatusBarMessage(const QString &)));
717
736
disconnect(Client::backlogManager(), SIGNAL(messagesProcessed(const QString &)), this, SLOT(showStatusBarMessage(const QString &)));
718
737
if(!Client::internalCore()) {
719
connect(Client::backlogManager(), SIGNAL(updateProgress(int, int)), msgProcessorStatusWidget, SLOT(setProgress(int, int)));
738
connect(Client::backlogManager(), SIGNAL(updateProgress(int, int)), _msgProcessorStatusWidget, SLOT(setProgress(int, int)));
720
739
connect(Client::backlogManager(), SIGNAL(messagesRequested(const QString &)), this, SLOT(showStatusBarMessage(const QString &)));
721
740
connect(Client::backlogManager(), SIGNAL(messagesProcessed(const QString &)), this, SLOT(showStatusBarMessage(const QString &)));
808
811
coll->action("CoreInfo")->setEnabled(false);
809
812
//_viewMenu->setEnabled(false);
810
813
statusBar()->showMessage(tr("Not connected to core."));
811
sslLabel->setPixmap(QPixmap());
813
updateLagIndicator();
814
coreLagLabel->hide();
815
if(msgProcessorStatusWidget)
816
msgProcessorStatusWidget->setProgress(0, 0);
814
if(_msgProcessorStatusWidget)
815
_msgProcessorStatusWidget->setProgress(0, 0);
818
systemTray()->setState(SystemTray::Inactive);
821
void MainWin::startInternalCore() {
822
ClientSyncer *syncer = new ClientSyncer();
823
Client::registerClientSyncer(syncer);
824
connect(syncer, SIGNAL(syncFinished()), syncer, SLOT(deleteLater()), Qt::QueuedConnection);
825
syncer->useInternalCore();
828
void MainWin::showCoreConnectionDlg(bool autoConnect) {
829
CoreConnectDlg(autoConnect, this).exec();
817
systemTray()->setState(SystemTray::Passive);
820
void MainWin::userAuthenticationRequired(CoreAccount *account, bool *valid, const QString &errorMessage) {
821
Q_UNUSED(errorMessage)
822
CoreConnectAuthDlg dlg(account, this);
823
*valid = (dlg.exec() == QDialog::Accepted);
826
void MainWin::handleNoSslInClient(bool *accepted) {
827
QMessageBox box(QMessageBox::Warning, tr("Unencrypted Connection"), tr("<b>Your client does not support SSL encryption</b>"),
828
QMessageBox::Ignore|QMessageBox::Cancel, this);
829
box.setInformativeText(tr("Sensitive data, like passwords, will be transmitted unencrypted to your Quassel core."));
830
box.setDefaultButton(QMessageBox::Ignore);
831
*accepted = box.exec() == QMessageBox::Ignore;
834
void MainWin::handleNoSslInCore(bool *accepted) {
835
QMessageBox box(QMessageBox::Warning, tr("Unencrypted Connection"), tr("<b>Your core does not support SSL encryption</b>"),
836
QMessageBox::Ignore|QMessageBox::Cancel, this);
837
box.setInformativeText(tr("Sensitive data, like passwords, will be transmitted unencrypted to your Quassel core."));
838
box.setDefaultButton(QMessageBox::Ignore);
839
*accepted = box.exec() == QMessageBox::Ignore;
845
void MainWin::handleSslErrors(const QSslSocket *socket, bool *accepted, bool *permanently) {
846
QString errorString = "<ul>";
847
foreach(const QSslError error, socket->sslErrors())
848
errorString += QString("<li>%1</li>").arg(error.errorString());
849
errorString += "</ul>";
851
QMessageBox box(QMessageBox::Warning,
852
tr("Untrusted Security Certificate"),
853
tr("<b>The SSL certificate provided by the core at %1 is untrusted for the following reasons:</b>").arg(socket->peerName()),
854
QMessageBox::Cancel, this);
855
box.setInformativeText(errorString);
856
box.addButton(tr("Continue"), QMessageBox::AcceptRole);
857
box.setDefaultButton(box.addButton(tr("Show Certificate"), QMessageBox::HelpRole));
859
QMessageBox::ButtonRole role;
862
role = box.buttonRole(box.clickedButton());
863
if(role == QMessageBox::HelpRole) {
864
SslInfoDlg dlg(socket, this);
867
} while(role == QMessageBox::HelpRole);
869
*accepted = role == QMessageBox::AcceptRole;
871
QMessageBox box2(QMessageBox::Warning,
872
tr("Untrusted Security Certificate"),
873
tr("Would you like to accept this certificate forever without being prompted?"),
875
box2.setDefaultButton(box2.addButton(tr("Current Session Only"), QMessageBox::NoRole));
876
box2.addButton(tr("Forever"), QMessageBox::YesRole);
878
*permanently = box2.buttonRole(box2.clickedButton()) == QMessageBox::YesRole;
882
#endif /* HAVE_SSL */
884
void MainWin::handleCoreConnectionError(const QString &error) {
885
QMessageBox::critical(this, tr("Core Connection Error"), error, QMessageBox::Ok);
888
void MainWin::showCoreConnectionDlg() {
889
CoreConnectDlg dlg(this);
890
if(dlg.exec() == QDialog::Accepted) {
891
AccountId accId = dlg.selectedAccount();
893
Client::coreConnection()->connectToCore(accId);
897
void MainWin::showCoreConfigWizard(const QVariantList &backends) {
898
CoreConfigWizard *wizard = new CoreConfigWizard(Client::coreConnection(), backends, this);
832
903
void MainWin::showChannelList(NetworkId netId) {
876
947
//Category: Interface
877
948
dlg->registerSettingsPage(new AppearanceSettingsPage(dlg));
878
949
dlg->registerSettingsPage(new ChatViewSettingsPage(dlg));
950
dlg->registerSettingsPage(new ChatMonitorSettingsPage(dlg));
879
951
dlg->registerSettingsPage(new ItemViewSettingsPage(dlg));
952
dlg->registerSettingsPage(new BufferViewSettingsPage(dlg));
880
953
dlg->registerSettingsPage(new InputWidgetSettingsPage(dlg));
881
954
dlg->registerSettingsPage(new TopicWidgetSettingsPage(dlg));
882
955
dlg->registerSettingsPage(new HighlightSettingsPage(dlg));
883
956
dlg->registerSettingsPage(new NotificationsSettingsPage(dlg));
884
957
dlg->registerSettingsPage(new BacklogSettingsPage(dlg));
885
dlg->registerSettingsPage(new BufferViewSettingsPage(dlg));
886
dlg->registerSettingsPage(new ChatMonitorSettingsPage(dlg));
889
dlg->registerSettingsPage(new GeneralSettingsPage(dlg));
890
960
dlg->registerSettingsPage(new ConnectionSettingsPage(dlg));
891
961
dlg->registerSettingsPage(new IdentitiesSettingsPage(dlg));
892
962
dlg->registerSettingsPage(new NetworksSettingsPage(dlg));
893
963
dlg->registerSettingsPage(new AliasesSettingsPage(dlg));
894
964
dlg->registerSettingsPage(new IgnoreListSettingsPage(dlg));
966
// Category: Remote Cores
967
if(Quassel::runMode() != Quassel::Monolithic) {
968
dlg->registerSettingsPage(new CoreAccountSettingsPage(dlg));
969
dlg->registerSettingsPage(new CoreConnectionSettingsPage(dlg));
947
void MainWin::changeEvent(QEvent *event) {
949
if(event->type() == QEvent::ActivationChange)
950
dwTickCount = GetTickCount(); // needed for toggleMinimizedToTray()
953
QMainWindow::changeEvent(event);
956
void MainWin::hideToTray() {
957
if(!systemTray()->isSystemTrayAvailable()) {
958
qWarning() << Q_FUNC_INFO << "was called with no SystemTray available!";
962
systemTray()->setIconVisible();
965
void MainWin::toggleMinimizedToTray() {
967
// the problem is that we lose focus when the systray icon is activated
968
// and we don't know the former active window
969
// therefore we watch for activation event and use our stopwatch :)
970
// courtesy: KSystemTrayIcon
971
if(GetTickCount() - dwTickCount >= 300)
972
// we weren't active in the last 300ms -> activate
979
if(!isVisible() || isMinimized())
988
void MainWin::forceActivated() {
991
KWindowSystem::forceActiveWindow(winId());
995
// Bypass focus stealing prevention
996
QX11Info::setAppUserTime(QX11Info::appTime());
999
if(windowState() & Qt::WindowMinimized) {
1001
setWindowState((windowState() & ~Qt::WindowMinimized) | Qt::WindowActive);
1004
// this does not actually work on all platforms... and causes more evil than good
1005
// move(frameGeometry().topLeft()); // avoid placement policies
1009
#endif /* HAVE_KDE */
1012
1023
void MainWin::messagesInserted(const QModelIndex &parent, int start, int end) {
1013
1024
Q_UNUSED(parent);