Changeset View
Changeset View
Standalone View
Standalone View
krunner/view.cpp
Show All 25 Lines | |||||
26 | #include <QScreen> | 26 | #include <QScreen> | ||
27 | #include <QQmlEngine> | 27 | #include <QQmlEngine> | ||
28 | #include <QClipboard> | 28 | #include <QClipboard> | ||
29 | #include <QPlatformSurfaceEvent> | 29 | #include <QPlatformSurfaceEvent> | ||
30 | 30 | | |||
31 | #include <KAuthorized> | 31 | #include <KAuthorized> | ||
32 | #include <KWindowSystem> | 32 | #include <KWindowSystem> | ||
33 | #include <KWindowEffects> | 33 | #include <KWindowEffects> | ||
34 | #include <KGlobalAccel> | | |||
35 | #include <KLocalizedString> | 34 | #include <KLocalizedString> | ||
36 | #include <KDirWatch> | 35 | #include <KDirWatch> | ||
37 | #include <KCrash> | 36 | #include <KCrash> | ||
38 | 37 | | |||
39 | #include <kdeclarative/qmlobject.h> | 38 | #include <kdeclarative/qmlobject.h> | ||
40 | 39 | | |||
41 | #include <KPackage/Package> | 40 | #include <KPackage/Package> | ||
42 | #include <KPackage/PackageLoader> | 41 | #include <KPackage/PackageLoader> | ||
Show All 21 Lines | 54 | { | |||
64 | m_config = KConfigGroup(KSharedConfig::openConfig(QStringLiteral("krunnerrc")), "General"); | 63 | m_config = KConfigGroup(KSharedConfig::openConfig(QStringLiteral("krunnerrc")), "General"); | ||
65 | 64 | | |||
66 | setFreeFloating(m_config.readEntry("FreeFloating", false)); | 65 | setFreeFloating(m_config.readEntry("FreeFloating", false)); | ||
67 | reloadConfig(); | 66 | reloadConfig(); | ||
68 | 67 | | |||
69 | new AppAdaptor(this); | 68 | new AppAdaptor(this); | ||
70 | QDBusConnection::sessionBus().registerObject(QStringLiteral("/App"), this); | 69 | QDBusConnection::sessionBus().registerObject(QStringLiteral("/App"), this); | ||
71 | 70 | | |||
72 | QAction *a = new QAction(nullptr); | | |||
73 | QObject::connect(a, &QAction::triggered, this, &View::displayOrHide); | | |||
74 | a->setText(i18n("Show KRunner")); | | |||
75 | a->setObjectName(QStringLiteral("run command")); | | |||
76 | a->setProperty("componentDisplayName", i18nc("Name for krunner shortcuts category", "KRunner")); | | |||
77 | KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << QKeySequence(Qt::ALT + Qt::Key_Space), KGlobalAccel::NoAutoloading); | | |||
78 | KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << QKeySequence(Qt::ALT + Qt::Key_Space) << QKeySequence(Qt::ALT + Qt::Key_F2) << Qt::Key_Search); | | |||
79 | | ||||
80 | a = new QAction(nullptr); | | |||
81 | QObject::connect(a, &QAction::triggered, this, &View::displayWithClipboardContents); | | |||
82 | a->setText(i18n("Run Command on clipboard contents")); | | |||
83 | a->setObjectName(QStringLiteral("run command on clipboard contents")); | | |||
84 | a->setProperty("componentDisplayName", i18nc("Name for krunner shortcuts category", "KRunner")); | | |||
85 | KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << QKeySequence(Qt::ALT+Qt::SHIFT+Qt::Key_F2)); | | |||
86 | KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << QKeySequence(Qt::ALT+Qt::SHIFT+Qt::Key_F2)); | | |||
87 | | ||||
88 | m_qmlObj = new KDeclarative::QmlObject(this); | 71 | m_qmlObj = new KDeclarative::QmlObject(this); | ||
89 | m_qmlObj->setInitializationDelayed(true); | 72 | m_qmlObj->setInitializationDelayed(true); | ||
90 | connect(m_qmlObj, &KDeclarative::QmlObject::finished, this, &View::objectIncubated); | 73 | connect(m_qmlObj, &KDeclarative::QmlObject::finished, this, &View::objectIncubated); | ||
91 | 74 | | |||
92 | KPackage::Package package = KPackage::PackageLoader::self()->loadPackage(QStringLiteral("Plasma/LookAndFeel")); | 75 | KPackage::Package package = KPackage::PackageLoader::self()->loadPackage(QStringLiteral("Plasma/LookAndFeel")); | ||
93 | KConfigGroup cg(KSharedConfig::openConfig(QStringLiteral("kdeglobals")), "KDE"); | 76 | KConfigGroup cg(KSharedConfig::openConfig(QStringLiteral("kdeglobals")), "KDE"); | ||
94 | const QString packageName = cg.readEntry("LookAndFeelPackage", QString()); | 77 | const QString packageName = cg.readEntry("LookAndFeelPackage", QString()); | ||
95 | if (!packageName.isEmpty()) { | 78 | if (!packageName.isEmpty()) { | ||
▲ Show 20 Lines • Show All 310 Lines • Show Last 20 Lines |