diff --git a/src/kleopatra.rc b/src/kleopatra.rc
index 39cee29f7..24d9509ca 100644
--- a/src/kleopatra.rc
+++ b/src/kleopatra.rc
@@ -1,127 +1,128 @@
Main Toolbar
+
-
+
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index c00f3cb51..33c5dfcb6 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -1,672 +1,680 @@
/* -*- mode: c++; c-basic-offset:4 -*-
mainwindow.cpp
This file is part of Kleopatra, the KDE keymanager
SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include
#include "mainwindow.h"
#include "aboutdata.h"
#include "view/padwidget.h"
#include "view/searchbar.h"
#include "view/tabwidget.h"
#include "view/keylistcontroller.h"
#include "view/keycacheoverlay.h"
#include "view/smartcardwidget.h"
#include "view/welcomewidget.h"
#include "commands/selftestcommand.h"
#include "commands/importcrlcommand.h"
#include "commands/importcertificatefromfilecommand.h"
#include "commands/decryptverifyfilescommand.h"
#include "commands/signencryptfilescommand.h"
#include "utils/detail_p.h"
#include
#include "utils/action_data.h"
#include "utils/filedialog.h"
#include "utils/clipboardmenu.h"
#include "dialogs/updatenotification.h"
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "kleopatra_debug.h"
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace Kleo;
using namespace Kleo::Commands;
using namespace GpgME;
static KGuiItem KStandardGuiItem_quit()
{
static const QString app = KAboutData::applicationData().componentName();
KGuiItem item = KStandardGuiItem::quit();
item.setText(i18nc("Quit [ApplicationName]", "&Quit %1", app));
return item;
}
static KGuiItem KStandardGuiItem_close()
{
KGuiItem item = KStandardGuiItem::close();
item.setText(i18n("Only &Close Window"));
return item;
}
static bool isQuitting = false;
+namespace
+{
+static const std::vector mainViewActionNames = {
+ QStringLiteral("view_certificate_overview"),
+ QStringLiteral("manage_smartcard"),
+ QStringLiteral("pad_view")
+};
+}
+
class MainWindow::Private
{
friend class ::MainWindow;
MainWindow *const q;
public:
explicit Private(MainWindow *qq);
~Private();
template
void createAndStart()
{
(new T(this->currentView(), &this->controller))->start();
}
template
void createAndStart(QAbstractItemView *view)
{
(new T(view, &this->controller))->start();
}
template
void createAndStart(const QStringList &a)
{
(new T(a, this->currentView(), &this->controller))->start();
}
template
void createAndStart(const QStringList &a, QAbstractItemView *view)
{
(new T(a, view, &this->controller))->start();
}
void closeAndQuit()
{
const QString app = KAboutData::applicationData().componentName();
const int rc = KMessageBox::questionYesNoCancel(q,
i18n("%1 may be used by other applications as a service.\n"
"You may instead want to close this window without exiting %1.", app),
i18n("Really Quit?"), KStandardGuiItem_close(), KStandardGuiItem_quit(), KStandardGuiItem::cancel(),
QLatin1String("really-quit-") + app.toLower());
if (rc == KMessageBox::Cancel) {
return;
}
isQuitting = true;
if (!q->close()) {
return;
}
// WARNING: 'this' might be deleted at this point!
if (rc == KMessageBox::No) {
qApp->quit();
}
}
void configureToolbars()
{
KEditToolBar dlg(q->factory());
dlg.exec();
}
void editKeybindings()
{
KShortcutsDialog::configure(q->actionCollection(), KShortcutsEditor::LetterShortcutsAllowed);
updateSearchBarClickMessage();
}
void updateSearchBarClickMessage()
{
const QString shortcutStr = focusToClickSearchAction->shortcut().toString();
ui.searchBar->updateClickMessage(shortcutStr);
}
void updateStatusBar()
{
const auto complianceMode = Formatting::complianceMode();
if (complianceMode == QStringLiteral("de-vs")) {
auto statusBar = new QStatusBar;
q->setStatusBar(statusBar);
auto statusLbl = new QLabel(Formatting::deVsString());
statusBar->insertPermanentWidget(0, statusLbl);
} else {
q->setStatusBar(nullptr);
}
}
void selfTest()
{
createAndStart();
}
void configureBackend();
void showHandbook();
void gnupgLogViewer()
{
if (!QProcess::startDetached(QStringLiteral("kwatchgnupg"), QStringList()))
KMessageBox::error(q, i18n("Could not start the GnuPG Log Viewer (kwatchgnupg). "
"Please check your installation."),
i18n("Error Starting KWatchGnuPG"));
}
void forceUpdateCheck()
{
UpdateNotification::forceUpdateCheck(q);
}
void openCompendium()
{
QDir datadir(QCoreApplication::applicationDirPath() + QStringLiteral("/../share/gpg4win"));
const auto path = datadir.filePath(i18nc("The Gpg4win compendium is only available"
"at this point (24.7.2017) in german and english."
"Please check with Gpg4win before translating this filename.",
"gpg4win-compendium-en.pdf"));
qCDebug(KLEOPATRA_LOG) << "Opening Compendium at:" << path;
// The compendium is always installed. So this should work. Otherwise
// we have debug output.
QDesktopServices::openUrl(QUrl::fromLocalFile(path));
}
void slotConfigCommitted();
void slotContextMenuRequested(QAbstractItemView *, const QPoint &p)
{
if (QMenu *const menu = qobject_cast(q->factory()->container(QStringLiteral("listview_popup"), q))) {
menu->exec(p);
} else {
qCDebug(KLEOPATRA_LOG) << "no \"listview_popup\"