SVN commit 1033221 by mzanetti: Add notification on incoming authentication challenge if view is not active BUG: 204600 M +25 -0 authenticationwizard.cpp M +1 -0 authenticationwizard.h M +2 -2 otrlchatinterface.cpp --- trunk/KDE/kdenetwork/kopete/plugins/otr/authenticationwizard.cpp #1033220:1033221 @@ -27,9 +27,12 @@ #include #include #include +#include +#include #include #include +#include QList wizardList; @@ -66,6 +69,17 @@ updateInfoBox(); show(); + + if ( !session->view()->mainWidget() || !session->view()->mainWidget()->isActiveWindow() ) { + KNotification *notification = new KNotification( "kopete_info_event", KNotification::CloseWhenWidgetActivated | KNotification::CloseOnTimeout ); + notification->setText( i18n( "Incoming authentication request from %1", OtrlChatInterface::self()->formatContact( session->members().first()->contactId() ) ) ); + notification->setPixmap( SmallIcon( "kopete" ) ); + notification->setWidget( this ); + notification->setActions( QStringList() << i18n( "View" ) << i18n( "Ignore" ) ); + connect( notification, SIGNAL( activated( unsigned int ) ), SLOT( notificationActivated( unsigned int ) ) ); + notification->sendEvent(); + } + } @@ -343,6 +357,17 @@ } } +void AuthenticationWizard::notificationActivated( unsigned int id){ + kDebug(14318) << "notificationActivated. ButtonId" << id; + if( id == 1 ){ + // raise the view to bring the chatwindow + authwizard to current desktop and on top + session->view()->raise( true ); + // now grab focus and keyboard again to the auth-wizard + setFocus(Qt::ActiveWindowFocusReason); + leAnswer->grabKeyboard(); + } +} + WaitPage::WaitPage(const QString &text){ canContinue = false; setTitle(i18nc("@title","Authenticating contact...")); --- trunk/KDE/kdenetwork/kopete/plugins/otr/authenticationwizard.h #1033220:1033221 @@ -90,6 +90,7 @@ private slots: void cancelVerification(); void updateInfoBox(); + void notificationActivated( unsigned int ); }; --- trunk/KDE/kdenetwork/kopete/plugins/otr/otrlchatinterface.cpp #1033220:1033221 @@ -413,7 +413,7 @@ abortSMP( context, chatSession ); } else { kDebug(14318) << "Update SMP state: 1Q"; - new AuthenticationWizard( chatSession->view()->mainWidget(), context, chatSession, false, QString((char*)tlvs->data) ); + new AuthenticationWizard( chatSession->view(true)->mainWidget(), context, chatSession, false, QString((char*)tlvs->data) ); } } @@ -424,7 +424,7 @@ abortSMP( context, chatSession ); } else { kDebug(14318) << "Update SMP state: 1 "; - new AuthenticationWizard( chatSession->view()->mainWidget(), context, chatSession, false ); + new AuthenticationWizard( chatSession->view(true)->mainWidget(), context, chatSession, false ); } } tlv = otrl_tlv_find(tlvs, OTRL_TLV_SMP2);