[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdepim/kleopatra/uiserver
From: Frank Osterfeld <frank.osterfeld () kdemail ! net>
Date: 2008-02-04 9:55:03
Message-ID: 1202118903.793591.8093.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 770649 by osterfeld:
add Controller baseclass, implement Controller::bringToForeground( QDialog* ), which \
ensures that the client WId is applied if available and does SetForegroundWindow on \
windows.
M +1 -9 assuanserverconnection.cpp
A controller.cpp [License: GPL (v2+) (+Qt exception)]
A controller.h [License: GPL (v2+) (+Qt exception)]
M +5 -27 encryptemailcontroller.cpp
M +2 -4 encryptemailcontroller.h
M +5 -12 signemailcontroller.cpp
M +2 -2 signemailcontroller.h
M +4 -12 signencryptfilescontroller.cpp
M +2 -2 signencryptfilescontroller.h
--- trunk/KDE/kdepim/kleopatra/uiserver/assuanserverconnection.cpp #770648:770649
@@ -1169,15 +1169,7 @@
if ( QWidget * pw = QWidget::find( wid ) )
dlg->setParent( pw );
else {
-#ifdef Q_WS_WIN
- //On Windows, setMainWindow isn't implemented (maybe can't),
- //we try to bring the window to foreground instead
- KWindowSystem::forceActiveWindow( dlg->winId() );
-#else
- //with other platforms, try to associate widget with the calling application
- if ( wid )
- KWindowSystem::setMainWindow( dlg, wid );
-#endif
+ KWindowSystem::setMainWindow( dlg, wid );
}
}
--- trunk/KDE/kdepim/kleopatra/uiserver/encryptemailcontroller.cpp #770648:770649
@@ -62,7 +62,7 @@
friend class ::Kleo::EncryptEMailController;
EncryptEMailController * const q;
public:
- explicit Private( const shared_ptr<AssuanCommand> & cmd, EncryptEMailController \
* qq ); + explicit Private( EncryptEMailController * qq );
private:
void slotWizardRecipientsResolved();
@@ -73,7 +73,6 @@
void ensureWizardCreated() const;
void ensureWizardVisible();
void cancelAllTasks();
- void applyWindowID() const;
void schedule();
shared_ptr<EncryptEMailTask> takeRunnable( GpgME::Protocol proto );
@@ -82,32 +81,21 @@
private:
std::vector< shared_ptr<EncryptEMailTask> > runnable, completed;
shared_ptr<EncryptEMailTask> cms, openpgp;
- weak_ptr<AssuanCommand> command;
mutable QPointer<SignEncryptWizard> wizard;
};
-EncryptEMailController::Private::Private( const shared_ptr<AssuanCommand> & cmd, \
EncryptEMailController * qq ) +EncryptEMailController::Private::Private( \
EncryptEMailController * qq ) : q( qq ),
runnable(),
cms(),
openpgp(),
- command( cmd ),
wizard()
{
}
-
-void EncryptEMailController::Private::applyWindowID() const
-{
- if ( !wizard )
- return;
- if ( const shared_ptr<AssuanCommand> cmd = command.lock() )
- cmd->applyWindowID( wizard );
-}
-
EncryptEMailController::EncryptEMailController( const shared_ptr<AssuanCommand> & \
cmd, QObject * p )
- : QObject( p ), d( new Private( cmd, this ) )
+ : Controller( cmd, p ), d( new Private( this ) )
{
}
@@ -127,12 +115,6 @@
d->wizard->setPresetProtocol( proto );
}
-void EncryptEMailController::setCommand( const shared_ptr<AssuanCommand> & cmd )
-{
- d->command = cmd;
- d->applyWindowID();
-}
-
Protocol EncryptEMailController::protocol() const {
d->ensureWizardCreated();
return d->wizard->selectedProtocol();
@@ -165,7 +147,7 @@
void EncryptEMailController::importIO() {
- const shared_ptr<AssuanCommand> cmd = d->command.lock();
+ const shared_ptr<AssuanCommand> cmd = command().lock();
kleo_assert( cmd );
const std::vector< shared_ptr<Input> > & inputs = cmd->inputs();
@@ -301,15 +283,11 @@
connect( w.get(), SIGNAL(recipientsResolved()), q, \
SLOT(slotWizardRecipientsResolved()), Qt::QueuedConnection );
connect( w.get(), SIGNAL(canceled()), q, SLOT(slotWizardCanceled()), \
Qt::QueuedConnection ); wizard = w.release();
- applyWindowID();
}
void EncryptEMailController::Private::ensureWizardVisible() {
ensureWizardCreated();
- if ( wizard->isVisible() )
- wizard->raise();
- else
- wizard->show();
+ q->bringToForeground( wizard );
}
#include "moc_encryptemailcontroller.cpp"
--- trunk/KDE/kdepim/kleopatra/uiserver/encryptemailcontroller.h #770648:770649
@@ -33,7 +33,7 @@
#ifndef __KLEOPATRA_UISERVER_ENCRYPTEMAILCONTROLLER_H__
#define __KLEOPATRA_UISERVER_ENCRYPTEMAILCONTROLLER_H__
-#include <QObject>
+#include "controller.h"
#include <utils/pimpl_ptr.h>
@@ -48,15 +48,13 @@
class AssuanCommand;
- class EncryptEMailController : public QObject {
+ class EncryptEMailController : public Controller {
Q_OBJECT
public:
explicit EncryptEMailController( const boost::shared_ptr<AssuanCommand> & \
cmd, QObject * parent=0 ); ~EncryptEMailController();
static const char * mementoName() { return "EncryptEMailController"; }
-
- void setCommand( const boost::shared_ptr<AssuanCommand> & cmd );
void setProtocol( GpgME::Protocol proto );
const char * protocolAsString() const;
--- trunk/KDE/kdepim/kleopatra/uiserver/signemailcontroller.cpp #770648:770649
@@ -62,7 +62,7 @@
friend class ::Kleo::SignEMailController;
SignEMailController * const q;
public:
- explicit Private( const shared_ptr<AssuanCommand> & cmd, SignEMailController * \
qq ); + explicit Private( SignEMailController * qq );
private:
void slotWizardSignersResolved();
@@ -81,18 +81,16 @@
private:
std::vector< shared_ptr<SignEMailTask> > runnable, completed; // ### extract to \
base shared_ptr<SignEMailTask> cms, openpgp; // ### extract to base
- weak_ptr<AssuanCommand> command; // ### extract to base
QPointer<SignEncryptWizard> wizard; // ### extract to base
Protocol protocol; // ### extract to base
bool detached : 1;
};
-SignEMailController::Private::Private( const shared_ptr<AssuanCommand> & cmd, \
SignEMailController * qq ) +SignEMailController::Private::Private( \
SignEMailController * qq ) : q( qq ),
runnable(),
cms(),
openpgp(),
- command( cmd ),
wizard(),
protocol( UnknownProtocol ),
detached( false )
@@ -101,7 +99,7 @@
}
SignEMailController::SignEMailController( const boost::shared_ptr<AssuanCommand> & \
cmd, QObject * p )
- : QObject( p ), d( new Private( cmd, this ) )
+ : Controller( cmd, p ), d( new Private( this ) )
{
}
@@ -159,7 +157,7 @@
// ### extract to base
void SignEMailController::importIO() {
- const shared_ptr<AssuanCommand> cmd = d->command.lock();
+ const shared_ptr<AssuanCommand> cmd = command().lock();
kleo_assert( cmd );
const std::vector< shared_ptr<Input> > & inputs = cmd->inputs();
@@ -298,8 +296,6 @@
return;
std::auto_ptr<SignEncryptWizard> w( new SignEncryptWizard );
- if ( const shared_ptr<AssuanCommand> cmd = command.lock() )
- cmd->applyWindowID( w.get() );
// ### virtual hook here
w->setWindowTitle( i18n("Sign Mail Message") );
@@ -325,10 +321,7 @@
// ### extract to base
void SignEMailController::Private::ensureWizardVisible() {
ensureWizardCreated();
- if ( wizard->isVisible() )
- wizard->raise();
- else
- wizard->show();
+ q->bringToForeground( wizard );
}
#include "moc_signemailcontroller.cpp"
--- trunk/KDE/kdepim/kleopatra/uiserver/signemailcontroller.h #770648:770649
@@ -33,7 +33,7 @@
#ifndef __KLEOPATRA_UISERVER_SIGNEMAILCONTROLLER_H__
#define __KLEOPATRA_UISERVER_SIGNEMAILCONTROLLER_H__
-#include <QObject>
+#include "controller.h"
#include <utils/pimpl_ptr.h>
@@ -48,7 +48,7 @@
class AssuanCommand;
- class SignEMailController : public QObject {
+ class SignEMailController : public Controller {
Q_OBJECT
public:
explicit SignEMailController( const boost::shared_ptr<AssuanCommand> & cmd, \
QObject * parent=0 );
--- trunk/KDE/kdepim/kleopatra/uiserver/signencryptfilescontroller.cpp #770648:770649
@@ -65,7 +65,7 @@
friend class ::Kleo::SignEncryptFilesController;
SignEncryptFilesController * const q;
public:
- explicit Private( const shared_ptr<AssuanCommand> & cmd, \
SignEncryptFilesController * qq ); + explicit Private( SignEncryptFilesController \
* qq );
private:
void slotWizardOperationPrepared();
@@ -91,19 +91,17 @@
private:
std::vector< shared_ptr<SignEncryptFilesTask> > runnable, completed;
shared_ptr<SignEncryptFilesTask> cms, openpgp;
- weak_ptr<AssuanCommand> command;
QPointer<SignEncryptFilesWizard> wizard;
unsigned int operation;
Protocol protocol;
bool errorDetected : 1;
};
-SignEncryptFilesController::Private::Private( const shared_ptr<AssuanCommand> & cmd, \
SignEncryptFilesController * qq ) +SignEncryptFilesController::Private::Private( \
SignEncryptFilesController * qq ) : q( qq ),
runnable(),
cms(),
openpgp(),
- command( cmd ),
wizard(),
operation( SignAllowed|EncryptAllowed ),
protocol( UnknownProtocol ),
@@ -129,7 +127,7 @@
}
SignEncryptFilesController::SignEncryptFilesController( const \
shared_ptr<AssuanCommand> & cmd, QObject * p )
- : QObject( p ), d( new Private( cmd, this ) )
+ : Controller( cmd, p ), d( new Private( this ) )
{
}
@@ -394,9 +392,6 @@
return;
std::auto_ptr<SignEncryptFilesWizard> w( new SignEncryptFilesWizard );
- if ( const shared_ptr<AssuanCommand> cmd = command.lock() )
- cmd->applyWindowID( w.get() );
-
w->setWindowTitle( titleForOperation( operation ) );
w->setAttribute( Qt::WA_DeleteOnClose );
@@ -407,10 +402,7 @@
void SignEncryptFilesController::Private::ensureWizardVisible() {
ensureWizardCreated();
- if ( wizard->isVisible() )
- wizard->raise();
- else
- wizard->show();
+ q->bringToForeground( wizard );
}
void SignEncryptFilesController::Private::removeInputFiles() {
--- trunk/KDE/kdepim/kleopatra/uiserver/signencryptfilescontroller.h #770648:770649
@@ -33,7 +33,7 @@
#ifndef __KLEOPATRA_UISERVER_SIGNENCRYPTFILESCONTROLLER_H__
#define __KLEOPATRA_UISERVER_SIGNENCRYPTFILESCONTROLLER_H__
-#include <QObject>
+#include "controller.h"
#include <utils/pimpl_ptr.h>
@@ -48,7 +48,7 @@
class AssuanCommand;
- class SignEncryptFilesController : public QObject {
+ class SignEncryptFilesController : public Controller {
Q_OBJECT
public:
explicit SignEncryptFilesController( const boost::shared_ptr<AssuanCommand> \
& cmd, QObject * parent=0 );
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic