Use a KCMultiDialog instead of calling kcmshell directly

Reviewed by Aleix
This commit is contained in:
Albert Astals Cid 2017-05-24 19:59:04 +02:00
parent d42a65e621
commit f01f751708
2 changed files with 8 additions and 2 deletions

View file

@ -1,6 +1,7 @@
find_package(KF5Notifications REQUIRED) find_package(KF5Notifications REQUIRED)
find_package(KF5KCMUtils REQUIRED)
add_executable(kdeconnect-indicator main.cpp deviceindicator.cpp) add_executable(kdeconnect-indicator main.cpp deviceindicator.cpp)
target_link_libraries(kdeconnect-indicator Qt5::Widgets KF5::CoreAddons KF5::I18n KF5::Notifications kdeconnectinterfaces) target_link_libraries(kdeconnect-indicator Qt5::Widgets KF5::CoreAddons KF5::I18n KF5::Notifications KF5::KCMUtils kdeconnectinterfaces)
install(TARGETS kdeconnect-indicator ${INSTALL_TARGETS_DEFAULT_ARGS}) install(TARGETS kdeconnect-indicator ${INSTALL_TARGETS_DEFAULT_ARGS})

View file

@ -32,6 +32,7 @@
#endif #endif
#include <KAboutData> #include <KAboutData>
#include <KCMultiDialog>
#include <KLocalizedString> #include <KLocalizedString>
#include "interfaces/devicesmodel.h" #include "interfaces/devicesmodel.h"
@ -61,7 +62,9 @@ int main(int argc, char** argv)
menu->clear(); menu->clear();
auto configure = menu->addAction(i18n("Configure...")); auto configure = menu->addAction(i18n("Configure..."));
QObject::connect(configure, &QAction::triggered, configure, [](){ QObject::connect(configure, &QAction::triggered, configure, [](){
QProcess::startDetached("kcmshell5", {"kdeconnect"}); KCMultiDialog dialog;
dialog.addModule("kcm_kdeconnect");
dialog.exec();
}); });
for (int i=0, count = model.rowCount(); i<count; ++i) { for (int i=0, count = model.rowCount(); i<count; ++i) {
DeviceDbusInterface* device = model.getDevice(i); DeviceDbusInterface* device = model.getDevice(i);
@ -115,5 +118,7 @@ int main(int argc, char** argv)
refreshMenu(); refreshMenu();
app.setQuitOnLastWindowClosed(false);
return app.exec(); return app.exec();
} }