From 94ef37623e3d8e88315d6343d7d18e9af4e679b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrius=20=C5=A0tikonas?= Date: Thu, 25 Aug 2016 00:15:07 +0100 Subject: [PATCH] Add About KPMcore Library action. --- src/gui/mainwindow.cpp | 52 +++++++++++++++++++++++------------ src/gui/mainwindow.h | 1 + src/gui/partitionmanagerui.rc | 4 ++- 3 files changed, 38 insertions(+), 19 deletions(-) diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index d3a3a2e..6deb5f8 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -75,6 +75,7 @@ #include #include +#include #include #include #include @@ -218,14 +219,6 @@ void MainWindow::setupActions() applyAllOperations->setIcon(QIcon::fromTheme(QStringLiteral("dialog-ok-apply")).pixmap(IconSize(KIconLoader::Toolbar))); // Device actions - QAction* refreshDevices = actionCollection()->addAction(QStringLiteral("refreshDevices")); - connect(refreshDevices, &QAction::triggered, this, &MainWindow::onRefreshDevices); - refreshDevices->setText(xi18nc("@action:inmenu refresh list of devices", "Refresh Devices")); - refreshDevices->setToolTip(xi18nc("@info:tooltip", "Refresh all devices")); - refreshDevices->setStatusTip(xi18nc("@info:status", "Renew the devices list.")); - actionCollection()->setDefaultShortcut(refreshDevices, Qt::Key_F5); - refreshDevices->setIcon(QIcon::fromTheme(QStringLiteral("view-refresh")).pixmap(IconSize(KIconLoader::Toolbar))); - QAction* createNewPartitionTable = actionCollection()->addAction(QStringLiteral("createNewPartitionTable")); connect(createNewPartitionTable, &QAction::triggered, this, &MainWindow::onCreateNewPartitionTable); createNewPartitionTable->setEnabled(false); @@ -251,15 +244,6 @@ void MainWindow::setupActions() importPartitionTable->setStatusTip(xi18nc("@info:status", "Import a partition table from a text file.")); importPartitionTable->setIcon(QIcon::fromTheme(QStringLiteral("document-import")).pixmap(IconSize(KIconLoader::Toolbar))); - QAction* createVolumeGroup = actionCollection()->addAction(QStringLiteral("createVolumeGroup")); - connect(createVolumeGroup, &QAction::triggered, this, &MainWindow::onCreateNewVolumeGroup); - createVolumeGroup->setEnabled(false); - createVolumeGroup->setText(i18nc("@action:inmenu", "New Volume")); - createVolumeGroup->setToolTip(i18nc("@info:tooltip", "Create a new LVM Volume Group")); - createVolumeGroup->setStatusTip(i18nc("@info:status", "Create a new LVM Volume Group as a device.")); - actionCollection()->setDefaultShortcut(createVolumeGroup, QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_L)); - createVolumeGroup->setIcon(QIcon::fromTheme(QStringLiteral("document-new")).pixmap(IconSize(KIconLoader::Toolbar))); - QAction* removeVolumeGroup = actionCollection()->addAction(QStringLiteral("removeVolumeGroup")); connect(removeVolumeGroup, &QAction::triggered, this, &MainWindow::onRemoveVolumeGroup); removeVolumeGroup->setEnabled(false); @@ -412,7 +396,16 @@ void MainWindow::setupActions() restore->setStatusTip(xi18nc("@info:status", "Restore a partition from an image file.")); restore->setIcon(QIcon::fromTheme(QStringLiteral("document-import")).pixmap(IconSize(KIconLoader::Toolbar))); - // View actions + // Tools actions + QAction* createVolumeGroup = actionCollection()->addAction(QStringLiteral("createVolumeGroup")); + connect(createVolumeGroup, &QAction::triggered, this, &MainWindow::onCreateNewVolumeGroup); + createVolumeGroup->setEnabled(false); + createVolumeGroup->setText(i18nc("@action:inmenu", "New Volume")); + createVolumeGroup->setToolTip(i18nc("@info:tooltip", "Create a new LVM Volume Group")); + createVolumeGroup->setStatusTip(i18nc("@info:status", "Create a new LVM Volume Group as a device.")); + actionCollection()->setDefaultShortcut(createVolumeGroup, QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_L)); + createVolumeGroup->setIcon(QIcon::fromTheme(QStringLiteral("document-new")).pixmap(IconSize(KIconLoader::Toolbar))); + QAction* fileSystemSupport = actionCollection()->addAction(QStringLiteral("fileSystemSupport")); connect(fileSystemSupport, &QAction::triggered, this, &MainWindow::onFileSystemSupport); fileSystemSupport->setText(xi18nc("@action:inmenu", "File System Support")); @@ -424,6 +417,15 @@ void MainWindow::setupActions() actionCollection()->addAction(QStringLiteral("toggleDockInformation"), dockInformation().toggleViewAction()); actionCollection()->addAction(QStringLiteral("toggleDockLog"), dockLog().toggleViewAction()); + + QAction* refreshDevices = actionCollection()->addAction(QStringLiteral("refreshDevices")); + connect(refreshDevices, &QAction::triggered, this, &MainWindow::onRefreshDevices); + refreshDevices->setText(xi18nc("@action:inmenu refresh list of devices", "Refresh Devices")); + refreshDevices->setToolTip(xi18nc("@info:tooltip", "Refresh all devices")); + refreshDevices->setStatusTip(xi18nc("@info:status", "Renew the devices list.")); + actionCollection()->setDefaultShortcut(refreshDevices, Qt::Key_F5); + refreshDevices->setIcon(QIcon::fromTheme(QStringLiteral("view-refresh")).pixmap(IconSize(KIconLoader::Toolbar))); + // Settings Actions KStandardAction::preferences(this, &MainWindow::onConfigureOptions, actionCollection()); @@ -441,6 +443,14 @@ void MainWindow::setupActions() saveLog->setToolTip(xi18nc("@info:tooltip", "Save the log output")); saveLog->setStatusTip(xi18nc("@info:status", "Save the log output to a file.")); saveLog->setIcon(QIcon::fromTheme(QStringLiteral("document-save")).pixmap(IconSize(KIconLoader::Toolbar))); + + // Help Actions + QAction* aboutKPMcore = actionCollection()->addAction(QStringLiteral("aboutKPMcore")); + connect(aboutKPMcore, &QAction::triggered, this, &MainWindow::onShowAboutKPMcore); + aboutKPMcore->setText(xi18nc("@action:inmenu", "About KPMcore Library")); + aboutKPMcore->setToolTip(xi18nc("@info:tooltip", "Show About KPMcore dialog")); + aboutKPMcore->setStatusTip(xi18nc("@info:status", "Show About KPMcore dialog.")); + aboutKPMcore->setIcon(QIcon::fromTheme(QStringLiteral("partitionmanager")).pixmap(IconSize(KIconLoader::Toolbar))); } void MainWindow::setupConnections() @@ -1146,6 +1156,12 @@ void MainWindow::onFileSystemSupport() dlg.exec(); } +void MainWindow::onShowAboutKPMcore() +{ + KAboutApplicationDialog dlg(aboutKPMcore(), this); + dlg.exec(); +} + void MainWindow::onSettingsChanged() { if (CoreBackendManager::self()->backend()->id() != Config::backend()) { diff --git a/src/gui/mainwindow.h b/src/gui/mainwindow.h index 1ebd510..100ff27 100644 --- a/src/gui/mainwindow.h +++ b/src/gui/mainwindow.h @@ -255,6 +255,7 @@ protected: void onSettingsChanged(); void onFileSystemSupport(); + void onShowAboutKPMcore(); void onSmartStatusDevice(); void onPropertiesDevice(const QString& deviceNode = {}); diff --git a/src/gui/partitionmanagerui.rc b/src/gui/partitionmanagerui.rc index 8f95e14..dc6c8bc 100644 --- a/src/gui/partitionmanagerui.rc +++ b/src/gui/partitionmanagerui.rc @@ -82,7 +82,9 @@ - + + +