File indexing completed on 2024-05-19 05:55:47

0001 /*
0002     SPDX-FileCopyrightText: 2003, 2004 George Staikos <staikos@kde.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "kwalletmanager.h"
0008 #include "kwalletmanagerwidget.h"
0009 #include "kwalletpopup.h"
0010 #include "kwalleteditor.h"
0011 #include "allyourbase.h"
0012 #include "kwallet_interface.h"
0013 #include "registercreateactionmethod.h"
0014 #include "kwalletmanager_debug.h"
0015 
0016 #include <kwindowsystem_version.h>
0017 #include <KWindowSystem>
0018 #include <KLocalizedString>
0019 #include <KConfig>
0020 #include <KMessageBox>
0021 #include <KStandardAction>
0022 #include <KStatusNotifierItem>
0023 #include <KWallet>
0024 #include <KXMLGUIFactory>
0025 #include <KActionCollection>
0026 #include <KConfigGroup>
0027 #include <KTar>
0028 #include <KIO/CommandLauncherJob>
0029 
0030 #include <QAction>
0031 #include <QCommandLineParser>
0032 #include <QIcon>
0033 #include <QDialog>
0034 #include <QFile>
0035 #include <QFileDialog>
0036 #include <QFileInfo>
0037 #include <QLineEdit>
0038 #include <QMimeDatabase>
0039 #include <QMimeType>
0040 #include <QTimer>
0041 #include <kwidgetsaddons_version.h>
0042 
0043 KWalletManager::KWalletManager(QCommandLineParser *commandLineParser)
0044     : KXmlGuiWindow()
0045     , _commandLineParser(commandLineParser)
0046 {
0047     _kwalletdLaunch = false;
0048     _shuttingDown = false;
0049     m_kwalletdModule = nullptr;
0050     RegisterCreateActionsMethod::createActions(actionCollection());
0051 
0052     QTimer::singleShot(0, this, &KWalletManager::beginConfiguration);
0053 
0054     processParsedCommandLine(ProgramStart);
0055 }
0056 
0057 void KWalletManager::beginConfiguration() {
0058     KConfig cfg(QStringLiteral("kwalletrc"));    // not sure why this setting isn't in kwalletmanagerrc...
0059     KConfigGroup walletConfigGroup(&cfg, QStringLiteral("Wallet"));
0060     if (walletConfigGroup.readEntry("Enabled", true)){
0061         QTimer::singleShot(0, this, &KWalletManager::configUI);
0062     } else {
0063         int rc = KMessageBox::warningTwoActions(this,
0064                                                 i18n("The KDE Wallet system is not enabled. Do you want me to enable it? If not, the KWalletManager will quit "
0065                                                      "as it cannot work without reading the wallets."),
0066                                                 {},
0067                                                 KStandardGuiItem::ok(),
0068                                                 KStandardGuiItem::cancel());
0069         if (rc == KMessageBox::ButtonCode::PrimaryAction) {
0070             walletConfigGroup.writeEntry("Enabled", true);
0071             QTimer::singleShot(0, this, &KWalletManager::configUI);
0072         } else {
0073             QApplication::quit();
0074         }
0075     }
0076 }
0077 
0078 void KWalletManager::configUI() {
0079     QDBusConnection::sessionBus().registerObject(QStringLiteral("/KWalletManager"), this, QDBusConnection::ExportScriptableSlots);
0080     KConfig cfg(QStringLiteral("kwalletrc"));    // not sure why this setting isn't in kwalletmanagerrc...
0081     KConfigGroup walletConfigGroup(&cfg, QStringLiteral("Wallet"));
0082     if (walletConfigGroup.readEntry("Launch Manager", false)) {
0083         _tray = new KStatusNotifierItem(this);
0084         _tray->setObjectName(QStringLiteral("kwalletmanager tray"));
0085         _tray->setCategory(KStatusNotifierItem::SystemServices);
0086         _tray->setStatus(KStatusNotifierItem::Passive);
0087         _tray->setIconByName(QStringLiteral("wallet-closed"));
0088         _tray->setToolTip(QStringLiteral("wallet-closed"), i18n("Wallet"), i18n("No wallets open."));
0089         //connect(_tray, SIGNAL(quitSelected()), SLOT(shuttingDown()));
0090         const QStringList wl = KWallet::Wallet::walletList();
0091         bool isOpen = false;
0092         for (QStringList::ConstIterator it = wl.begin(), end = wl.end(); it != end; ++it) {
0093             if (KWallet::Wallet::isOpen(*it)) {
0094                 _tray->setIconByName(QStringLiteral("wallet-open"));
0095                 _tray->setToolTip(QStringLiteral("wallet-open"), i18n("Wallet"), i18n("A wallet is open."));
0096                 isOpen = true;
0097                 break;
0098             }
0099         }
0100         if (!isOpen && qApp->isSessionRestored()) {
0101             delete _tray;
0102             _tray = nullptr;
0103             QTimer::singleShot(0, qApp, SLOT(quit()));
0104             return;
0105         }
0106     } else {
0107         _tray = nullptr;
0108     }
0109 
0110     _managerWidget = new KWalletManagerWidget(this);
0111 
0112     updateWalletDisplay();
0113     setCentralWidget(_managerWidget);
0114     setAutoSaveSettings(QStringLiteral("MainWindow"), true);
0115     QFontMetrics fm = fontMetrics();
0116     _managerWidget->setMinimumSize(16*fm.height(), 18*fm.height());
0117 
0118     m_kwalletdModule = new org::kde::KWallet(QStringLiteral("org.kde.kwalletd5"), QStringLiteral("/modules/kwalletd5"), QDBusConnection::sessionBus());
0119     connect(QDBusConnection::sessionBus().interface(), &QDBusConnectionInterface::serviceOwnerChanged, this,
0120             &KWalletManager::possiblyRescan);
0121     connect(QDBusConnection::sessionBus().interface(),
0122             &QDBusConnectionInterface::callWithCallbackFailed, this,
0123             [this](const QDBusError error, const QDBusMessage call) {
0124               if (call.interface() == QStringLiteral("org.kde.KWallet")) {
0125                 _managerWidget->setErrorMessage(error.message());
0126               }
0127             });
0128     connect(m_kwalletdModule, &OrgKdeKWalletInterface::allWalletsClosed, this, &KWalletManager::allWalletsClosed);
0129     connect(m_kwalletdModule, SIGNAL(walletClosed(QString)),
0130             this, SLOT(updateWalletDisplay()));
0131     connect(m_kwalletdModule, &OrgKdeKWalletInterface::walletOpened, this, &KWalletManager::aWalletWasOpened);
0132     connect(m_kwalletdModule, &OrgKdeKWalletInterface::walletDeleted, this, &KWalletManager::updateWalletDisplay);
0133     connect(m_kwalletdModule, &OrgKdeKWalletInterface::walletListDirty, this, &KWalletManager::updateWalletDisplay);
0134     connect(m_kwalletdModule, &OrgKdeKWalletInterface::walletCreated, this, &KWalletManager::walletCreated);
0135     // FIXME: slight race - a wallet can open, then we get launched, but the
0136     //        wallet closes before we are done opening.  We will then stay
0137     //        open.  Must check that a wallet is still open here.
0138 
0139     QAction *action = actionCollection()->addAction(QStringLiteral("wallet_create"));
0140     action->setText(i18n("&New Wallet..."));
0141     action->setIcon(QIcon::fromTheme(QStringLiteral("kwalletmanager")));
0142     connect(action, &QAction::triggered, this, &KWalletManager::createWallet);
0143 
0144     action = actionCollection()->addAction(QStringLiteral("wallet_delete"));
0145     action->setText(i18n("&Delete Wallet..."));
0146     action->setIcon(QIcon::fromTheme(QStringLiteral("trash-empty")));
0147     connect(action, &QAction::triggered, this, &KWalletManager::deleteWallet);
0148 
0149     _walletsExportAction = actionCollection()->addAction(QStringLiteral("wallet_export_encrypted"));
0150     _walletsExportAction->setText(i18n("Export as encrypted"));
0151     _walletsExportAction->setIcon(QIcon::fromTheme(QStringLiteral("document-export")));
0152     connect(_walletsExportAction, &QAction::triggered, this, &KWalletManager::exportWallets);
0153 
0154     action = actionCollection()->addAction(QStringLiteral("wallet_import_encrypted"));
0155     action->setText(i18n("&Import encrypted"));
0156     action->setIcon(QIcon::fromTheme(QStringLiteral("document-import")));
0157     connect(action, &QAction::triggered, this, &KWalletManager::importWallets);
0158 
0159     QAction *act = actionCollection()->addAction(QStringLiteral("wallet_settings"));
0160     act->setText(i18n("Configure &Wallet..."));
0161     act->setIcon(QIcon::fromTheme(QStringLiteral("configure")));
0162 
0163     connect(act, &QAction::triggered, this, &KWalletManager::setupWallet);
0164     if (_tray) {
0165         _tray->contextMenu()->addAction(act);
0166     }
0167     act = actionCollection()->addAction(QStringLiteral("close_all_wallets"));
0168     act->setText(i18n("Close &All Wallets"));
0169     connect(act, &QAction::triggered, this, &KWalletManager::closeAllWallets);
0170     if (_tray) {
0171         _tray->contextMenu()->addAction(act);
0172     }
0173     KStandardAction::quit(this, SLOT(shuttingDown()), actionCollection());
0174 
0175     KStandardAction::keyBindings(guiFactory(), &KXMLGUIFactory::showConfigureShortcutsDialog, actionCollection());
0176 
0177     setupGUI(Keys | Save | Create, QStringLiteral("kwalletmanager.rc"));
0178     setStandardToolBarMenuEnabled(false);
0179 
0180     if (_tray) {
0181 //        _tray->show();
0182     } else {
0183         show();
0184     }
0185 
0186     _walletsExportAction->setDisabled(KWallet::Wallet::walletList().isEmpty());
0187     qApp->setObjectName(QStringLiteral("kwallet"));   // hack to fix docs
0188 }
0189 
0190 KWalletManager::~KWalletManager()
0191 {
0192     _tray = nullptr;
0193     delete m_kwalletdModule;
0194     m_kwalletdModule = nullptr;
0195 }
0196 
0197 void KWalletManager::kwalletdLaunch()
0198 {
0199     _kwalletdLaunch = true;
0200 }
0201 
0202 bool KWalletManager::queryClose()
0203 {
0204     if (hasUnsavedChanges() && !canIgnoreUnsavedChanges()) {
0205         return false;
0206     }
0207 
0208     if (!_shuttingDown) {
0209         if (!_tray) {
0210             qApp->quit();
0211         } else {
0212             _tray->hideAssociatedWindow();
0213         }
0214         return false;
0215     }
0216     return true;
0217 }
0218 
0219 void KWalletManager::aWalletWasOpened()
0220 {
0221     if (_tray) {
0222         _tray->setIconByName(QStringLiteral("wallet-open"));
0223         _tray->setToolTip(QStringLiteral("wallet-open"), i18n("Wallet"), i18n("A wallet is open."));
0224         _tray->setStatus(KStatusNotifierItem::Active);
0225     }
0226     updateWalletDisplay();
0227     createGUI(QStringLiteral("kwalletmanager.rc"));
0228 }
0229 
0230 void KWalletManager::updateWalletDisplay()
0231 {
0232     if (_walletsExportAction) {
0233         _walletsExportAction->setDisabled(KWallet::Wallet::walletList().isEmpty());
0234     }
0235     _managerWidget->updateWalletDisplay();
0236 }
0237 
0238 void KWalletManager::walletCreated(const QString &newWalletName)
0239 {
0240     _managerWidget->updateWalletDisplay(newWalletName);
0241 }
0242 
0243 void KWalletManager::contextMenu(const QPoint &)
0244 {
0245 }
0246 
0247 void KWalletManager::closeWallet(const QString &walletName)
0248 {
0249     if (hasUnsavedChanges(walletName) && !canIgnoreUnsavedChanges()) {
0250         return;
0251     }
0252 
0253     int rc = KWallet::Wallet::closeWallet(walletName, false);
0254     if (rc != 0) {
0255         rc =
0256             KMessageBox::warningTwoActions(this,
0257                                            i18n("Unable to close wallet cleanly. It is probably in use by other applications. Do you wish to force it closed?"),
0258                                            QString(),
0259                                            KGuiItem(i18n("Force Closure")),
0260                                            KGuiItem(i18n("Do Not Force")));
0261         if (rc == KMessageBox::ButtonCode::PrimaryAction) {
0262             rc = KWallet::Wallet::closeWallet(walletName, true);
0263             if (rc != 0) {
0264                 KMessageBox::error(this, i18n("Unable to force the wallet closed. Error code was %1.", rc));
0265             }
0266         }
0267     }
0268 
0269     updateWalletDisplay();
0270 }
0271 
0272 void KWalletManager::changeWalletPassword(const QString &walletName)
0273 {
0274     KWallet::Wallet::changePassword(walletName, effectiveWinId());
0275 }
0276 
0277 void KWalletManager::openWalletFile(const QString &path)
0278 {
0279     if (!_managerWidget->openWalletFile(path)) {
0280         KMessageBox::error(this, i18n("Error opening wallet %1.", path));
0281     }
0282 }
0283 
0284 void KWalletManager::allWalletsClosed()
0285 {
0286     if (_tray) {
0287         _tray->setIconByName(QStringLiteral("wallet-closed"));
0288         _tray->setToolTip(QStringLiteral("wallet-closed"), i18n("Wallet"), i18n("No wallets open."));
0289         _tray->setStatus(KStatusNotifierItem::Passive);
0290     }
0291     possiblyQuit();
0292 }
0293 
0294 void KWalletManager::possiblyQuit()
0295 {
0296     KConfig _cfg(QStringLiteral("kwalletrc"));
0297     KConfigGroup cfg(&_cfg, QStringLiteral("Wallet"));
0298     if (_windows.isEmpty() &&
0299             !isVisible() &&
0300             !cfg.readEntry("Leave Manager Open", false) &&
0301             _kwalletdLaunch) {
0302         qApp->quit();
0303     }
0304 }
0305 
0306 void KWalletManager::editorClosed(KXmlGuiWindow *e)
0307 {
0308     _windows.removeAll(e);
0309 }
0310 
0311 void KWalletManager::possiblyRescan(const QString &app, const QString &oldOwner, const QString &newOwner)
0312 {
0313     Q_UNUSED(oldOwner);
0314     Q_UNUSED(newOwner);
0315     if (app == QLatin1String("org.kde.kwalletd5")) {
0316         updateWalletDisplay();
0317     }
0318 }
0319 
0320 void KWalletManager::createWallet()
0321 {
0322     QString txt = i18n("Please choose a name for the new wallet:");
0323 
0324     if (!KWallet::Wallet::isEnabled()) {
0325         // FIXME: KMessageBox::warningYesNo(this, i1_8n("KWallet is not enabled.  Do you want to enable it?"), QString(), i18n("Enable"), i18n("Keep Disabled"));
0326         return;
0327     }
0328     // TODO port to QRegularExpressionValidator
0329     QDialog nameDialog(this);
0330     nameDialog.setWindowTitle(i18nc("@title:window", "New Wallet"));
0331     nameDialog.setLayout(new QVBoxLayout);
0332     nameDialog.layout()->addWidget(new QLabel(txt));
0333     auto lineEdit = new QLineEdit;
0334     nameDialog.layout()->addWidget(lineEdit);
0335 
0336     auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
0337     connect(buttonBox, &QDialogButtonBox::accepted, &nameDialog, &QDialog::accept);
0338     connect(buttonBox, &QDialogButtonBox::rejected, &nameDialog, &QDialog::reject);
0339     nameDialog.layout()->addWidget(buttonBox);
0340 
0341     QString name;
0342     do {
0343         if (!nameDialog.exec()) {
0344             return;
0345         }
0346 
0347         name = lineEdit->text();
0348         if (name.trimmed().isEmpty()) {
0349             KMessageBox::error(this, i18n("Empty name is not supported. Please select a new one."), i18n("Create new wallet"));
0350             return;
0351         }
0352 
0353         if (_managerWidget->hasWallet(name)) {
0354             int rc = KMessageBox::questionTwoActions(this,
0355                                                      i18n("Sorry, that wallet already exists. Try a new name?"),
0356                                                      QString(),
0357                                                      KGuiItem(i18n("Try New")),
0358                                                      KGuiItem(i18n("Do Not Try")));
0359             if (rc == KMessageBox::ButtonCode::SecondaryAction) {
0360                 return;
0361             }
0362             lineEdit->clear();
0363         } else  {
0364             break;
0365         }
0366     } while (true);
0367 
0368     // Small race here - the wallet could be created on us already.
0369     if (!name.isEmpty()) {
0370         // attempt open the wallet to create it, then dispose it
0371         // as it'll appear in on the main window via the walletCreated signal
0372         // emmitted by the kwalletd
0373         KWallet::Wallet::openWallet(name, effectiveWinId());
0374     }
0375 }
0376 
0377 void KWalletManager::deleteWallet()
0378 {
0379     QString walletName = _managerWidget->activeWalletName();
0380     if (walletName.isEmpty()) {
0381         return;
0382     }
0383     int rc = KMessageBox::warningContinueCancel(this, i18n("Are you sure you wish to delete the wallet '%1'?", walletName), QString(), KStandardGuiItem::del());
0384     if (rc != KMessageBox::Continue) {
0385         return;
0386     }
0387     rc = KWallet::Wallet::deleteWallet(walletName);
0388     if (rc != 0) {
0389         KMessageBox::error(this, i18n("Unable to delete the wallet. Error code was %1.", rc));
0390     }
0391 }
0392 
0393 void KWalletManager::openWallet(const QString &walletName)
0394 {
0395     _managerWidget->openWallet(walletName);
0396 }
0397 
0398 void KWalletManager::shuttingDown()
0399 {
0400     if (hasUnsavedChanges() && !canIgnoreUnsavedChanges()) {
0401         return;
0402     }
0403 
0404     _shuttingDown = true;
0405     qApp->quit();
0406 }
0407 
0408 void KWalletManager::setupWallet()
0409 {
0410     auto job = new KIO::CommandLauncherJob(QStringLiteral("kcmshell6"), {QStringLiteral("kcm_kwallet5")});
0411     job->start();
0412 }
0413 
0414 void KWalletManager::closeAllWallets()
0415 {
0416     if (hasUnsavedChanges() && !canIgnoreUnsavedChanges()) {
0417         return;
0418 
0419     }
0420 
0421     m_kwalletdModule->closeAllWallets();
0422 }
0423 
0424 void KWalletManager::exportWallets()
0425 {
0426     const QString path = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QStringLiteral("/kwalletd/");
0427     const QDir dir(path);
0428     dir.mkpath(path);
0429 
0430     Q_ASSERT(dir.exists());
0431 
0432     const QStringList filesList = dir.entryList(QStringList() << QStringLiteral("*.kwl") << QStringLiteral("*.salt"),
0433                                                 QDir::Files | QDir::Readable | QDir::NoSymLinks);
0434 
0435     Q_ASSERT(!filesList.isEmpty());
0436 
0437     const QString destination = QFileDialog::getSaveFileName(this,i18n("File name"));
0438     if (destination.isEmpty()) {
0439         return;
0440     }
0441 
0442     KTar archive(destination);
0443     if (!archive.open(QIODevice::WriteOnly)) {
0444         KMessageBox::error(this, i18n("Failed to open file for writing"));
0445         return;
0446     }
0447 
0448     for (int i = 0; i < filesList.size(); i++) {
0449         archive.addLocalFile(path + filesList.at(i), filesList.at(i));
0450     }
0451 }
0452 
0453 void KWalletManager::importWallets()
0454 {
0455     const QString source = QFileDialog::getOpenFileName(this, i18n("Select file"));
0456     const QString destinationDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QStringLiteral("/kwalletd/");
0457     QDir().mkpath(destinationDir);
0458 
0459     if (source.isEmpty()) {
0460         return;
0461     }
0462 
0463     KTar archive(source);
0464     if (!archive.open(QIODevice::ReadOnly)) {
0465         KMessageBox::error(this, i18n("Failed to open file"));
0466         return;
0467     }
0468 
0469     const KArchiveDirectory *archiveDir = archive.directory();
0470     const QStringList archiveEntries = archiveDir->entries();
0471 
0472     for (int i = 0; i < archiveEntries.size(); i++) {
0473         if (QFile::exists(destinationDir + archiveEntries.at(i))
0474                 && archiveEntries.at(i).endsWith(QLatin1String(".kwl"))) {
0475             QString walletName = archiveEntries.at(i);
0476             // remove ".kwl"
0477             walletName.chop(4);
0478             KMessageBox::error(this, i18n("Wallet named %1 already exists, Operation aborted",
0479                                           walletName));
0480             return;
0481         }
0482     }
0483 
0484     if (!archiveDir->copyTo(destinationDir, false)) {
0485         KMessageBox::error(this,i18n("Failed to copy files"));
0486         return;
0487     }
0488 
0489 }
0490 
0491 bool KWalletManager::hasUnsavedChanges(const QString &name) const
0492 {
0493     return _managerWidget->hasUnsavedChanges(name);
0494 }
0495 
0496 bool KWalletManager::canIgnoreUnsavedChanges()
0497 {
0498     int rc = KMessageBox::warningTwoActions(this, i18n("Ignore unsaved changes?"), {}, KGuiItem(i18n("Ignore")), KStandardGuiItem::cancel());
0499     return (rc == KMessageBox::ButtonCode::PrimaryAction);
0500 }
0501 
0502 void KWalletManager::handleActivate(const QStringList &arguments, const QString &workingDirectory)
0503 {
0504     Q_UNUSED(workingDirectory);
0505 
0506     // DBus activation or KDBusService::Unique handling without cmdl arguments
0507     if (arguments.isEmpty()) {
0508         // app start or activation for kwalletmanager historically does not mean "show the window"
0509         // just ensure the manager is running in the systray, if configured like that.
0510         // In the other case KWalletManager::configUI() will ensure a window is shown on first start.
0511         activateForStartLikeCall(false);
0512         return;
0513     }
0514 
0515     // KDBusService::Unique handling
0516     _commandLineParser->parse(arguments);
0517 
0518     processParsedCommandLine(RemoteCall);
0519 }
0520 
0521 void KWalletManager::processParsedCommandLine(CommandLineOrigin commandLineOrigin)
0522 {
0523     const bool shoWWindow = _commandLineParser->isSet(QStringLiteral("show"));
0524     if (commandLineOrigin == ProgramStart) {
0525         if (shoWWindow)
0526             show();
0527     } else {
0528         activateForStartLikeCall(shoWWindow);
0529     }
0530 
0531     if (_commandLineParser->isSet(QStringLiteral("kwalletd"))) {
0532         kwalletdLaunch();
0533     }
0534 
0535     const QStringList positionalArguments = _commandLineParser->positionalArguments();
0536     QStringList localFiles;
0537     for (const QString &arg : positionalArguments) {
0538         const QString fn = QFileInfo(arg).absoluteFilePath();
0539         if (QFile::exists(fn)) {
0540             localFiles.append(fn);
0541         } else {
0542             openWallet(arg);
0543         }
0544     }
0545     tryOpenWalletFiles(localFiles);
0546 }
0547 
0548 void KWalletManager::handleOpen(const QList<QUrl> &urls)
0549 {
0550     QStringList localFiles;
0551     for (const QUrl& url : urls) {
0552         localFiles.append(url.toLocalFile());
0553     }
0554     tryOpenWalletFiles(localFiles);
0555     activateForStartLikeCall(false);
0556 }
0557 
0558 void KWalletManager::tryOpenWalletFiles(const QStringList &localFiles)
0559 {
0560     QMimeDatabase mimeDb;
0561     for (const QString &localFile : localFiles) {
0562         if (QFile::exists(localFile)) {
0563             QMimeType mt = mimeDb.mimeTypeForFile(localFile, QMimeDatabase::MatchContent);
0564 
0565             if (mt.isValid() && mt.inherits(QStringLiteral("application/x-kwallet"))) {
0566                 openWalletFile(localFile);
0567             }
0568         }
0569     }
0570 }
0571 
0572 void KWalletManager::activateForStartLikeCall(bool showWindow)
0573 {
0574     if (showWindow) {
0575         show();
0576     }
0577     KWindowSystem::updateStartupId(windowHandle());
0578 
0579     if (showWindow) {
0580         if (isMinimized())
0581             setWindowState(windowState() & ~Qt::WindowMinimized);
0582         else if (_tray && !isVisible()) // TODO: how does this relate to show() above?
0583             _tray->activate(QPoint());
0584     }
0585     // if there is a window visible, now or before, always activate it
0586     if (isVisible()) {
0587         if (!isActiveWindow()) {
0588             raise();
0589             KWindowSystem::activateWindow(windowHandle());
0590         }
0591     }
0592 }
0593 
0594 #include "moc_kwalletmanager.cpp"