From 4b1f94af9a6a065a3519d663d048101e7e6db5cc Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Tue, 1 Nov 2016 22:17:51 +0000 Subject: [PATCH] plasma: remove homerun applet Signed-off-by: Ivailo Monev --- plasma/applets/CMakeLists.txt | 1 - plasma/applets/homerun/CMakeLists.txt | 28 - plasma/applets/homerun/COPYING | 14 - plasma/applets/homerun/LICENSE.BSD | 20 - plasma/applets/homerun/LICENSE.GPL-2 | 339 -- plasma/applets/homerun/LICENSE.LGPL-2.1 | 502 --- plasma/applets/homerun/Messages.sh | 4 - plasma/applets/homerun/README.md | 87 - .../applets/homerun/components/CMakeLists.txt | 79 - .../components/abstractsourceregistry.cpp | 47 - .../components/abstractsourceregistry.h | 54 - plasma/applets/homerun/components/action.cpp | 74 - plasma/applets/homerun/components/action.h | 69 - .../homerun/components/actionmanager.cpp | 104 - .../homerun/components/actionmanager.h | 92 - .../homerun/components/componentsplugin.cpp | 52 - .../homerun/components/componentsplugin.h | 36 - .../applets/homerun/components/customtypes.h | 30 - .../homerun/components/globalsettings.cpp | 97 - .../homerun/components/globalsettings.h | 58 - .../homerun/components/helpmenuactions.cpp | 73 - .../homerun/components/helpmenuactions.h | 58 - .../applets/homerun/components/icondialog.cpp | 47 - .../applets/homerun/components/icondialog.h | 42 - plasma/applets/homerun/components/image.cpp | 98 - plasma/applets/homerun/components/image.h | 61 - .../applets/homerun/components/messagebox.cpp | 45 - .../applets/homerun/components/messagebox.h | 60 - .../homerun/components/qml/ActionMenu.qml | 103 - .../homerun/components/qml/DragArea.qml | 170 - .../homerun/components/qml/DragContainer.qml | 30 - .../applets/homerun/components/qml/Label.qml | 68 - .../applets/homerun/components/qml/TabBar.qml | 120 - .../homerun/components/qml/TabButton.qml | 199 -- .../homerun/components/qml/TabGroup.qml | 274 -- .../components/qml/private/IconLoader.qml | 140 - .../components/qml/private/TabGroup.js | 114 - plasma/applets/homerun/components/qml/qmldir | 9 - .../homerun/components/shadoweffect.cpp | 240 -- .../applets/homerun/components/shadoweffect.h | 88 - .../components/sourceconfigurationdialog.cpp | 53 - .../components/sourceconfigurationdialog.h | 56 - .../homerun/components/sourcemodel.cpp | 215 -- .../applets/homerun/components/sourcemodel.h | 73 - .../homerun/components/sourceregistry.cpp | 449 --- .../homerun/components/sourceregistry.h | 81 - .../sources/dir/dirconfigurationwidget.cpp | 68 - .../sources/dir/dirconfigurationwidget.h | 48 - .../sources/dir/dirconfigurationwidget.ui | 83 - .../components/sources/dir/dirmodel.cpp | 262 -- .../homerun/components/sources/dir/dirmodel.h | 113 - .../sources/favorites/favoriteappsmodel.cpp | 354 -- .../sources/favorites/favoriteappsmodel.h | 90 - .../sources/favorites/favoriteplacesmodel.cpp | 166 - .../sources/favorites/favoriteplacesmodel.h | 78 - .../sources/favorites/favoriteutils.cpp | 48 - .../sources/favorites/favoriteutils.h | 39 - .../sources/favorites/fileplacesmodel.cpp | 876 ----- .../sources/favorites/fileplacesmodel.h | 159 - .../sources/favorites/kfileplacesitem.cpp | 325 -- .../sources/favorites/kfileplacesitem_p.h | 102 - .../favorites/kfileplacessharedbookmarks.cpp | 281 -- .../favorites/kfileplacessharedbookmarks_p.h | 56 - .../sources/installedapps/changenotifier.cpp | 81 - .../sources/installedapps/changenotifier.h | 62 - .../filterableinstalledappsmodel.cpp | 319 -- .../filterableinstalledappsmodel.h | 158 - .../groupedinstalledappsmodel.cpp | 161 - .../installedapps/groupedinstalledappsmodel.h | 80 - .../installedappsconfigurationwidget.cpp | 146 - .../installedappsconfigurationwidget.h | 63 - .../installedappsconfigurationwidget.ui | 50 - .../installedapps/installedappsmodel.cpp | 484 --- .../installedapps/installedappsmodel.h | 190 -- .../power/combinedpowersessionmodel.cpp | 321 -- .../sources/power/combinedpowersessionmodel.h | 128 - .../components/sources/power/powermodel.cpp | 94 - .../components/sources/power/powermodel.h | 40 - .../sources/recentapps/recentappsmodel.cpp | 305 -- .../sources/recentapps/recentappsmodel.h | 84 - .../sources/runners/querymatchmodel.cpp | 194 -- .../sources/runners/querymatchmodel.h | 84 - .../runners/runnerconfigurationwidget.cpp | 104 - .../runners/runnerconfigurationwidget.h | 48 - .../runners/runnerconfigurationwidget.ui | 48 - .../sources/runners/runnermodel.cpp | 292 -- .../components/sources/runners/runnermodel.h | 133 - .../sources/runners/singlerunnermodel.cpp | 131 - .../sources/runners/singlerunnermodel.h | 87 - .../sources/session/openedsessionsmodel.cpp | 92 - .../sources/session/openedsessionsmodel.h | 53 - .../sources/session/sessionmodel.cpp | 118 - .../components/sources/session/sessionmodel.h | 45 - .../sources/session/sessionswatcher.cpp | 92 - .../sources/session/sessionswatcher.h | 53 - .../homerun/components/standarditemmodel.cpp | 90 - .../homerun/components/standarditemmodel.h | 79 - .../applets/homerun/components/tabmodel.cpp | 375 --- plasma/applets/homerun/components/tabmodel.h | 87 - plasma/applets/homerun/config/homerunkickerrc | 26 - plasma/applets/homerun/config/homerunrc | 60 - plasma/applets/homerun/data/favoriteapps.xml | 6 - .../homerun/devdoc/helloworld/CMakeLists.txt | 33 - .../homerun/devdoc/helloworld/helloworld.cpp | 75 - .../homerun/devdoc/helloworld/helloworld.h | 55 - .../homerun-source-helloworld.desktop | 71 - plasma/applets/homerun/devdoc/overview.md | 73 - .../applets/homerun/devdoc/release_howto.md | 76 - plasma/applets/homerun/fixes/CMakeLists.txt | 26 - plasma/applets/homerun/fixes/README.md | 37 - .../fixes/declarativeitemcontainer.cpp | 186 -- .../fixes/declarativeitemcontainer_p.h | 59 - plasma/applets/homerun/fixes/dialog.cpp | 447 --- plasma/applets/homerun/fixes/dialog.h | 245 -- plasma/applets/homerun/fixes/fixesplugin.cpp | 37 - plasma/applets/homerun/fixes/fixesplugin.h | 35 - .../applets/homerun/fixes/qml/TextField.qml | 433 --- .../fixes/qml/private/TextFieldFocus.qml | 98 - plasma/applets/homerun/fixes/qml/qmldir | 3 - .../applets/homerun/fixes/toolboxtoggle.cpp | 82 - plasma/applets/homerun/fixes/toolboxtoggle.h | 52 - .../applets/homerun/fullscreen/CMakeLists.txt | 3 - .../homerun/fullscreen/applet/CMakeLists.txt | 19 - .../homerun/fullscreen/applet/configkeys.h | 26 - .../fullscreen/applet/generalconfigpage.ui | 39 - .../fullscreen/applet/homerunlauncher.cpp | 218 -- .../fullscreen/applet/homerunlauncher.h | 74 - ...lasma-applet-homerunlauncher.desktop.cmake | 81 - .../homerun/fullscreen/package/CMakeLists.txt | 14 - .../package/contents/config/main.xml | 24 - .../contents/ui/AvailableSourceItem.qml | 76 - .../package/contents/ui/DebugRectangle.qml | 30 - .../package/contents/ui/LogText.qml | 32 - .../package/contents/ui/MessageItem.qml | 91 - .../fullscreen/package/contents/ui/Page.qml | 726 ---- .../fullscreen/package/contents/ui/Result.qml | 223 -- .../package/contents/ui/ResultsView.qml | 387 --- .../package/contents/ui/SlidingContainer.qml | 36 - .../package/contents/ui/SourceItem.qml | 100 - .../package/contents/ui/TabContent.qml | 317 -- .../package/contents/ui/TabContentInternal.js | 85 - .../package/contents/ui/TabSideButton.qml | 30 - .../fullscreen/package/contents/ui/config.ui | 108 - .../fullscreen/package/contents/ui/main.qml | 453 --- .../fullscreen/package/metadata.desktop.cmake | 81 - .../homerun/fullscreen/viewer/CMakeLists.txt | 26 - .../homerun/fullscreen/viewer/fullview.cpp | 249 -- .../homerun/fullscreen/viewer/fullview.h | 81 - .../fullscreen/viewer/homerunviewer.desktop | 73 - .../homerun/fullscreen/viewer/main.cpp | 102 - .../viewer/org.kde.homerunviewer.xml | 20 - plasma/applets/homerun/homerun_config.h.in | 1 - plasma/applets/homerun/icons/CMakeLists.txt | 1 - .../homerun/icons/hi128-apps-homerun.png | Bin 11697 -> 0 bytes .../homerun/icons/hi16-apps-homerun.png | Bin 993 -> 0 bytes .../homerun/icons/hi22-apps-homerun.png | Bin 1297 -> 0 bytes .../homerun/icons/hi32-apps-homerun.png | Bin 2008 -> 0 bytes .../homerun/icons/hi48-apps-homerun.png | Bin 3255 -> 0 bytes .../homerun/icons/hi64-apps-homerun.png | Bin 4783 -> 0 bytes .../homerun/icons/hisc-apps-homerun.svgz | Bin 7215 -> 0 bytes plasma/applets/homerun/icons/lighter-logo.svg | 2919 ----------------- plasma/applets/homerun/internal/aboutdata.cpp | 54 - plasma/applets/homerun/internal/aboutdata.h | 41 - .../applets/homerun/internal/i18nconfig.cpp | 34 - plasma/applets/homerun/kicker/CMakeLists.txt | 2 - .../homerun/kicker/components/CMakeLists.txt | 23 - .../homerun/kicker/components/appletproxy.cpp | 58 - .../homerun/kicker/components/appletproxy.h | 48 - .../kicker/components/fadeouteffect.cpp | 67 - .../homerun/kicker/components/fadeouteffect.h | 42 - .../homerun/kicker/components/fadeoutitem.cpp | 59 - .../homerun/kicker/components/fadeoutitem.h | 43 - .../kicker/components/kickerplugin.cpp | 44 - .../homerun/kicker/components/kickerplugin.h | 34 - .../kicker/components/processrunner.cpp | 36 - .../homerun/kicker/components/processrunner.h | 35 - .../applets/homerun/kicker/components/qmldir | 1 - .../kicker/components/sourcelistmodel.cpp | 119 - .../kicker/components/sourcelistmodel.h | 59 - .../kicker/components/urlconverter.cpp | 34 - .../homerun/kicker/components/urlconverter.h | 37 - .../kicker/components/windowsystem.cpp | 66 - .../homerun/kicker/components/windowsystem.h | 42 - .../homerun/kicker/package/CMakeLists.txt | 14 - .../kicker/package/contents/config/main.xml | 29 - .../package/contents/ui/ItemListDelegate.qml | 302 -- .../package/contents/ui/ItemListDialog.qml | 92 - .../package/contents/ui/ItemListView.qml | 187 -- .../package/contents/ui/PopupButton.qml | 110 - .../package/contents/ui/SidebarItem.qml | 156 - .../package/contents/ui/SidebarSection.qml | 89 - .../kicker/package/contents/ui/config.ui | 204 -- .../kicker/package/contents/ui/main.qml | 573 ---- .../kicker/package/metadata.desktop.cmake | 61 - plasma/applets/homerun/lib/CMakeLists.txt | 87 - plasma/applets/homerun/lib/Doxyfile.in | 288 -- .../homerun/lib/HomerunConfig.cmake.in | 17 - plasma/applets/homerun/lib/abstractsource.cpp | 74 - plasma/applets/homerun/lib/abstractsource.h | 167 - plasma/applets/homerun/lib/actionlist.cpp | 140 - plasma/applets/homerun/lib/actionlist.h | 63 - .../homerun/lib/homerun-source.desktop | 37 - plasma/applets/homerun/lib/homerun_export.h | 35 - plasma/applets/homerun/lib/homerunmodel.md | 160 - .../homerun/lib/libhomerun_config.h.in | 24 - plasma/applets/homerun/lib/mainpage.md | 8 - plasma/applets/homerun/lib/pathmodel.cpp | 85 - plasma/applets/homerun/lib/pathmodel.h | 61 - .../homerun/lib/sourceconfigurationwidget.cpp | 60 - .../homerun/lib/sourceconfigurationwidget.h | 73 - plasma/applets/homerun/plugins/CMakeLists.txt | 1 - .../plugins/recentdocuments/CMakeLists.txt | 29 - .../homerun-source-recentdocuments.desktop | 74 - .../recentdocuments/recentdocuments.cpp | 158 - .../plugins/recentdocuments/recentdocuments.h | 62 - plasma/applets/homerun/tests/CMakeLists.txt | 1 - .../applets/homerun/tests/auto/CMakeLists.txt | 90 - .../homerun/tests/auto/dirmodeltest.cpp | 149 - .../applets/homerun/tests/auto/dirmodeltest.h | 39 - .../tests/auto/favoriteappsmodeltest.cpp | 249 -- .../tests/auto/favoriteappsmodeltest.h | 47 - .../tests/auto/favoriteplacesmodeltest.cpp | 105 - .../tests/auto/favoriteplacesmodeltest.h | 42 - .../homerun/tests/auto/i18nconfigtest.cpp | 52 - .../homerun/tests/auto/i18nconfigtest.h | 37 - .../homerun/tests/auto/sourcemodeltest.cpp | 75 - .../homerun/tests/auto/sourcemodeltest.h | 45 - .../homerun/tests/auto/tabmodeltest.cpp | 664 ---- .../applets/homerun/tests/auto/tabmodeltest.h | 53 - .../tests/manual/keyboard-navigation.md | 51 - 230 files changed, 28029 deletions(-) delete mode 100644 plasma/applets/homerun/CMakeLists.txt delete mode 100644 plasma/applets/homerun/COPYING delete mode 100644 plasma/applets/homerun/LICENSE.BSD delete mode 100644 plasma/applets/homerun/LICENSE.GPL-2 delete mode 100644 plasma/applets/homerun/LICENSE.LGPL-2.1 delete mode 100644 plasma/applets/homerun/Messages.sh delete mode 100644 plasma/applets/homerun/README.md delete mode 100644 plasma/applets/homerun/components/CMakeLists.txt delete mode 100644 plasma/applets/homerun/components/abstractsourceregistry.cpp delete mode 100644 plasma/applets/homerun/components/abstractsourceregistry.h delete mode 100644 plasma/applets/homerun/components/action.cpp delete mode 100644 plasma/applets/homerun/components/action.h delete mode 100644 plasma/applets/homerun/components/actionmanager.cpp delete mode 100644 plasma/applets/homerun/components/actionmanager.h delete mode 100644 plasma/applets/homerun/components/componentsplugin.cpp delete mode 100644 plasma/applets/homerun/components/componentsplugin.h delete mode 100644 plasma/applets/homerun/components/customtypes.h delete mode 100644 plasma/applets/homerun/components/globalsettings.cpp delete mode 100644 plasma/applets/homerun/components/globalsettings.h delete mode 100644 plasma/applets/homerun/components/helpmenuactions.cpp delete mode 100644 plasma/applets/homerun/components/helpmenuactions.h delete mode 100644 plasma/applets/homerun/components/icondialog.cpp delete mode 100644 plasma/applets/homerun/components/icondialog.h delete mode 100644 plasma/applets/homerun/components/image.cpp delete mode 100644 plasma/applets/homerun/components/image.h delete mode 100644 plasma/applets/homerun/components/messagebox.cpp delete mode 100644 plasma/applets/homerun/components/messagebox.h delete mode 100644 plasma/applets/homerun/components/qml/ActionMenu.qml delete mode 100644 plasma/applets/homerun/components/qml/DragArea.qml delete mode 100644 plasma/applets/homerun/components/qml/DragContainer.qml delete mode 100644 plasma/applets/homerun/components/qml/Label.qml delete mode 100644 plasma/applets/homerun/components/qml/TabBar.qml delete mode 100644 plasma/applets/homerun/components/qml/TabButton.qml delete mode 100644 plasma/applets/homerun/components/qml/TabGroup.qml delete mode 100644 plasma/applets/homerun/components/qml/private/IconLoader.qml delete mode 100644 plasma/applets/homerun/components/qml/private/TabGroup.js delete mode 100644 plasma/applets/homerun/components/qml/qmldir delete mode 100644 plasma/applets/homerun/components/shadoweffect.cpp delete mode 100644 plasma/applets/homerun/components/shadoweffect.h delete mode 100644 plasma/applets/homerun/components/sourceconfigurationdialog.cpp delete mode 100644 plasma/applets/homerun/components/sourceconfigurationdialog.h delete mode 100644 plasma/applets/homerun/components/sourcemodel.cpp delete mode 100644 plasma/applets/homerun/components/sourcemodel.h delete mode 100644 plasma/applets/homerun/components/sourceregistry.cpp delete mode 100644 plasma/applets/homerun/components/sourceregistry.h delete mode 100644 plasma/applets/homerun/components/sources/dir/dirconfigurationwidget.cpp delete mode 100644 plasma/applets/homerun/components/sources/dir/dirconfigurationwidget.h delete mode 100644 plasma/applets/homerun/components/sources/dir/dirconfigurationwidget.ui delete mode 100644 plasma/applets/homerun/components/sources/dir/dirmodel.cpp delete mode 100644 plasma/applets/homerun/components/sources/dir/dirmodel.h delete mode 100644 plasma/applets/homerun/components/sources/favorites/favoriteappsmodel.cpp delete mode 100644 plasma/applets/homerun/components/sources/favorites/favoriteappsmodel.h delete mode 100644 plasma/applets/homerun/components/sources/favorites/favoriteplacesmodel.cpp delete mode 100644 plasma/applets/homerun/components/sources/favorites/favoriteplacesmodel.h delete mode 100644 plasma/applets/homerun/components/sources/favorites/favoriteutils.cpp delete mode 100644 plasma/applets/homerun/components/sources/favorites/favoriteutils.h delete mode 100644 plasma/applets/homerun/components/sources/favorites/fileplacesmodel.cpp delete mode 100644 plasma/applets/homerun/components/sources/favorites/fileplacesmodel.h delete mode 100644 plasma/applets/homerun/components/sources/favorites/kfileplacesitem.cpp delete mode 100644 plasma/applets/homerun/components/sources/favorites/kfileplacesitem_p.h delete mode 100644 plasma/applets/homerun/components/sources/favorites/kfileplacessharedbookmarks.cpp delete mode 100644 plasma/applets/homerun/components/sources/favorites/kfileplacessharedbookmarks_p.h delete mode 100644 plasma/applets/homerun/components/sources/installedapps/changenotifier.cpp delete mode 100644 plasma/applets/homerun/components/sources/installedapps/changenotifier.h delete mode 100644 plasma/applets/homerun/components/sources/installedapps/filterableinstalledappsmodel.cpp delete mode 100644 plasma/applets/homerun/components/sources/installedapps/filterableinstalledappsmodel.h delete mode 100644 plasma/applets/homerun/components/sources/installedapps/groupedinstalledappsmodel.cpp delete mode 100644 plasma/applets/homerun/components/sources/installedapps/groupedinstalledappsmodel.h delete mode 100644 plasma/applets/homerun/components/sources/installedapps/installedappsconfigurationwidget.cpp delete mode 100644 plasma/applets/homerun/components/sources/installedapps/installedappsconfigurationwidget.h delete mode 100644 plasma/applets/homerun/components/sources/installedapps/installedappsconfigurationwidget.ui delete mode 100644 plasma/applets/homerun/components/sources/installedapps/installedappsmodel.cpp delete mode 100644 plasma/applets/homerun/components/sources/installedapps/installedappsmodel.h delete mode 100644 plasma/applets/homerun/components/sources/power/combinedpowersessionmodel.cpp delete mode 100644 plasma/applets/homerun/components/sources/power/combinedpowersessionmodel.h delete mode 100644 plasma/applets/homerun/components/sources/power/powermodel.cpp delete mode 100644 plasma/applets/homerun/components/sources/power/powermodel.h delete mode 100644 plasma/applets/homerun/components/sources/recentapps/recentappsmodel.cpp delete mode 100644 plasma/applets/homerun/components/sources/recentapps/recentappsmodel.h delete mode 100644 plasma/applets/homerun/components/sources/runners/querymatchmodel.cpp delete mode 100644 plasma/applets/homerun/components/sources/runners/querymatchmodel.h delete mode 100644 plasma/applets/homerun/components/sources/runners/runnerconfigurationwidget.cpp delete mode 100644 plasma/applets/homerun/components/sources/runners/runnerconfigurationwidget.h delete mode 100644 plasma/applets/homerun/components/sources/runners/runnerconfigurationwidget.ui delete mode 100644 plasma/applets/homerun/components/sources/runners/runnermodel.cpp delete mode 100644 plasma/applets/homerun/components/sources/runners/runnermodel.h delete mode 100644 plasma/applets/homerun/components/sources/runners/singlerunnermodel.cpp delete mode 100644 plasma/applets/homerun/components/sources/runners/singlerunnermodel.h delete mode 100644 plasma/applets/homerun/components/sources/session/openedsessionsmodel.cpp delete mode 100644 plasma/applets/homerun/components/sources/session/openedsessionsmodel.h delete mode 100644 plasma/applets/homerun/components/sources/session/sessionmodel.cpp delete mode 100644 plasma/applets/homerun/components/sources/session/sessionmodel.h delete mode 100644 plasma/applets/homerun/components/sources/session/sessionswatcher.cpp delete mode 100644 plasma/applets/homerun/components/sources/session/sessionswatcher.h delete mode 100644 plasma/applets/homerun/components/standarditemmodel.cpp delete mode 100644 plasma/applets/homerun/components/standarditemmodel.h delete mode 100644 plasma/applets/homerun/components/tabmodel.cpp delete mode 100644 plasma/applets/homerun/components/tabmodel.h delete mode 100644 plasma/applets/homerun/config/homerunkickerrc delete mode 100644 plasma/applets/homerun/config/homerunrc delete mode 100644 plasma/applets/homerun/data/favoriteapps.xml delete mode 100644 plasma/applets/homerun/devdoc/helloworld/CMakeLists.txt delete mode 100644 plasma/applets/homerun/devdoc/helloworld/helloworld.cpp delete mode 100644 plasma/applets/homerun/devdoc/helloworld/helloworld.h delete mode 100644 plasma/applets/homerun/devdoc/helloworld/homerun-source-helloworld.desktop delete mode 100644 plasma/applets/homerun/devdoc/overview.md delete mode 100644 plasma/applets/homerun/devdoc/release_howto.md delete mode 100644 plasma/applets/homerun/fixes/CMakeLists.txt delete mode 100644 plasma/applets/homerun/fixes/README.md delete mode 100644 plasma/applets/homerun/fixes/declarativeitemcontainer.cpp delete mode 100644 plasma/applets/homerun/fixes/declarativeitemcontainer_p.h delete mode 100644 plasma/applets/homerun/fixes/dialog.cpp delete mode 100644 plasma/applets/homerun/fixes/dialog.h delete mode 100644 plasma/applets/homerun/fixes/fixesplugin.cpp delete mode 100644 plasma/applets/homerun/fixes/fixesplugin.h delete mode 100644 plasma/applets/homerun/fixes/qml/TextField.qml delete mode 100644 plasma/applets/homerun/fixes/qml/private/TextFieldFocus.qml delete mode 100644 plasma/applets/homerun/fixes/qml/qmldir delete mode 100644 plasma/applets/homerun/fixes/toolboxtoggle.cpp delete mode 100644 plasma/applets/homerun/fixes/toolboxtoggle.h delete mode 100644 plasma/applets/homerun/fullscreen/CMakeLists.txt delete mode 100644 plasma/applets/homerun/fullscreen/applet/CMakeLists.txt delete mode 100644 plasma/applets/homerun/fullscreen/applet/configkeys.h delete mode 100644 plasma/applets/homerun/fullscreen/applet/generalconfigpage.ui delete mode 100644 plasma/applets/homerun/fullscreen/applet/homerunlauncher.cpp delete mode 100644 plasma/applets/homerun/fullscreen/applet/homerunlauncher.h delete mode 100644 plasma/applets/homerun/fullscreen/applet/plasma-applet-homerunlauncher.desktop.cmake delete mode 100644 plasma/applets/homerun/fullscreen/package/CMakeLists.txt delete mode 100644 plasma/applets/homerun/fullscreen/package/contents/config/main.xml delete mode 100644 plasma/applets/homerun/fullscreen/package/contents/ui/AvailableSourceItem.qml delete mode 100644 plasma/applets/homerun/fullscreen/package/contents/ui/DebugRectangle.qml delete mode 100644 plasma/applets/homerun/fullscreen/package/contents/ui/LogText.qml delete mode 100644 plasma/applets/homerun/fullscreen/package/contents/ui/MessageItem.qml delete mode 100644 plasma/applets/homerun/fullscreen/package/contents/ui/Page.qml delete mode 100644 plasma/applets/homerun/fullscreen/package/contents/ui/Result.qml delete mode 100644 plasma/applets/homerun/fullscreen/package/contents/ui/ResultsView.qml delete mode 100644 plasma/applets/homerun/fullscreen/package/contents/ui/SlidingContainer.qml delete mode 100644 plasma/applets/homerun/fullscreen/package/contents/ui/SourceItem.qml delete mode 100644 plasma/applets/homerun/fullscreen/package/contents/ui/TabContent.qml delete mode 100644 plasma/applets/homerun/fullscreen/package/contents/ui/TabContentInternal.js delete mode 100644 plasma/applets/homerun/fullscreen/package/contents/ui/TabSideButton.qml delete mode 100644 plasma/applets/homerun/fullscreen/package/contents/ui/config.ui delete mode 100644 plasma/applets/homerun/fullscreen/package/contents/ui/main.qml delete mode 100644 plasma/applets/homerun/fullscreen/package/metadata.desktop.cmake delete mode 100644 plasma/applets/homerun/fullscreen/viewer/CMakeLists.txt delete mode 100644 plasma/applets/homerun/fullscreen/viewer/fullview.cpp delete mode 100644 plasma/applets/homerun/fullscreen/viewer/fullview.h delete mode 100644 plasma/applets/homerun/fullscreen/viewer/homerunviewer.desktop delete mode 100644 plasma/applets/homerun/fullscreen/viewer/main.cpp delete mode 100644 plasma/applets/homerun/fullscreen/viewer/org.kde.homerunviewer.xml delete mode 100644 plasma/applets/homerun/homerun_config.h.in delete mode 100644 plasma/applets/homerun/icons/CMakeLists.txt delete mode 100644 plasma/applets/homerun/icons/hi128-apps-homerun.png delete mode 100644 plasma/applets/homerun/icons/hi16-apps-homerun.png delete mode 100644 plasma/applets/homerun/icons/hi22-apps-homerun.png delete mode 100644 plasma/applets/homerun/icons/hi32-apps-homerun.png delete mode 100644 plasma/applets/homerun/icons/hi48-apps-homerun.png delete mode 100644 plasma/applets/homerun/icons/hi64-apps-homerun.png delete mode 100644 plasma/applets/homerun/icons/hisc-apps-homerun.svgz delete mode 100644 plasma/applets/homerun/icons/lighter-logo.svg delete mode 100644 plasma/applets/homerun/internal/aboutdata.cpp delete mode 100644 plasma/applets/homerun/internal/aboutdata.h delete mode 100644 plasma/applets/homerun/internal/i18nconfig.cpp delete mode 100644 plasma/applets/homerun/kicker/CMakeLists.txt delete mode 100644 plasma/applets/homerun/kicker/components/CMakeLists.txt delete mode 100644 plasma/applets/homerun/kicker/components/appletproxy.cpp delete mode 100644 plasma/applets/homerun/kicker/components/appletproxy.h delete mode 100644 plasma/applets/homerun/kicker/components/fadeouteffect.cpp delete mode 100644 plasma/applets/homerun/kicker/components/fadeouteffect.h delete mode 100644 plasma/applets/homerun/kicker/components/fadeoutitem.cpp delete mode 100644 plasma/applets/homerun/kicker/components/fadeoutitem.h delete mode 100644 plasma/applets/homerun/kicker/components/kickerplugin.cpp delete mode 100644 plasma/applets/homerun/kicker/components/kickerplugin.h delete mode 100644 plasma/applets/homerun/kicker/components/processrunner.cpp delete mode 100644 plasma/applets/homerun/kicker/components/processrunner.h delete mode 100644 plasma/applets/homerun/kicker/components/qmldir delete mode 100644 plasma/applets/homerun/kicker/components/sourcelistmodel.cpp delete mode 100644 plasma/applets/homerun/kicker/components/sourcelistmodel.h delete mode 100644 plasma/applets/homerun/kicker/components/urlconverter.cpp delete mode 100644 plasma/applets/homerun/kicker/components/urlconverter.h delete mode 100644 plasma/applets/homerun/kicker/components/windowsystem.cpp delete mode 100644 plasma/applets/homerun/kicker/components/windowsystem.h delete mode 100644 plasma/applets/homerun/kicker/package/CMakeLists.txt delete mode 100644 plasma/applets/homerun/kicker/package/contents/config/main.xml delete mode 100644 plasma/applets/homerun/kicker/package/contents/ui/ItemListDelegate.qml delete mode 100644 plasma/applets/homerun/kicker/package/contents/ui/ItemListDialog.qml delete mode 100644 plasma/applets/homerun/kicker/package/contents/ui/ItemListView.qml delete mode 100644 plasma/applets/homerun/kicker/package/contents/ui/PopupButton.qml delete mode 100644 plasma/applets/homerun/kicker/package/contents/ui/SidebarItem.qml delete mode 100644 plasma/applets/homerun/kicker/package/contents/ui/SidebarSection.qml delete mode 100644 plasma/applets/homerun/kicker/package/contents/ui/config.ui delete mode 100644 plasma/applets/homerun/kicker/package/contents/ui/main.qml delete mode 100644 plasma/applets/homerun/kicker/package/metadata.desktop.cmake delete mode 100644 plasma/applets/homerun/lib/CMakeLists.txt delete mode 100644 plasma/applets/homerun/lib/Doxyfile.in delete mode 100644 plasma/applets/homerun/lib/HomerunConfig.cmake.in delete mode 100644 plasma/applets/homerun/lib/abstractsource.cpp delete mode 100644 plasma/applets/homerun/lib/abstractsource.h delete mode 100644 plasma/applets/homerun/lib/actionlist.cpp delete mode 100644 plasma/applets/homerun/lib/actionlist.h delete mode 100644 plasma/applets/homerun/lib/homerun-source.desktop delete mode 100644 plasma/applets/homerun/lib/homerun_export.h delete mode 100644 plasma/applets/homerun/lib/homerunmodel.md delete mode 100644 plasma/applets/homerun/lib/libhomerun_config.h.in delete mode 100644 plasma/applets/homerun/lib/mainpage.md delete mode 100644 plasma/applets/homerun/lib/pathmodel.cpp delete mode 100644 plasma/applets/homerun/lib/pathmodel.h delete mode 100644 plasma/applets/homerun/lib/sourceconfigurationwidget.cpp delete mode 100644 plasma/applets/homerun/lib/sourceconfigurationwidget.h delete mode 100644 plasma/applets/homerun/plugins/CMakeLists.txt delete mode 100644 plasma/applets/homerun/plugins/recentdocuments/CMakeLists.txt delete mode 100644 plasma/applets/homerun/plugins/recentdocuments/homerun-source-recentdocuments.desktop delete mode 100644 plasma/applets/homerun/plugins/recentdocuments/recentdocuments.cpp delete mode 100644 plasma/applets/homerun/plugins/recentdocuments/recentdocuments.h delete mode 100644 plasma/applets/homerun/tests/CMakeLists.txt delete mode 100644 plasma/applets/homerun/tests/auto/CMakeLists.txt delete mode 100644 plasma/applets/homerun/tests/auto/dirmodeltest.cpp delete mode 100644 plasma/applets/homerun/tests/auto/dirmodeltest.h delete mode 100644 plasma/applets/homerun/tests/auto/favoriteappsmodeltest.cpp delete mode 100644 plasma/applets/homerun/tests/auto/favoriteappsmodeltest.h delete mode 100644 plasma/applets/homerun/tests/auto/favoriteplacesmodeltest.cpp delete mode 100644 plasma/applets/homerun/tests/auto/favoriteplacesmodeltest.h delete mode 100644 plasma/applets/homerun/tests/auto/i18nconfigtest.cpp delete mode 100644 plasma/applets/homerun/tests/auto/i18nconfigtest.h delete mode 100644 plasma/applets/homerun/tests/auto/sourcemodeltest.cpp delete mode 100644 plasma/applets/homerun/tests/auto/sourcemodeltest.h delete mode 100644 plasma/applets/homerun/tests/auto/tabmodeltest.cpp delete mode 100644 plasma/applets/homerun/tests/auto/tabmodeltest.h delete mode 100644 plasma/applets/homerun/tests/manual/keyboard-navigation.md diff --git a/plasma/applets/CMakeLists.txt b/plasma/applets/CMakeLists.txt index c2ed4b5c..81242821 100644 --- a/plasma/applets/CMakeLists.txt +++ b/plasma/applets/CMakeLists.txt @@ -22,7 +22,6 @@ add_subdirectory(systemtray) add_subdirectory(kickoff) add_subdirectory(trash) if(LIBKONQ_FOUND) - add_subdirectory(homerun) add_subdirectory(folderview) endif() diff --git a/plasma/applets/homerun/CMakeLists.txt b/plasma/applets/homerun/CMakeLists.txt deleted file mode 100644 index 36036934..00000000 --- a/plasma/applets/homerun/CMakeLists.txt +++ /dev/null @@ -1,28 +0,0 @@ -project(homerun) - -# Packaging -set(HOMERUN_VERSION "1.2.5") - -# Compile options -add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS}) -add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS) -add_definitions(-std=c++0x) -include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES}) - -# configuration file -configure_file(homerun_config.h.in ${CMAKE_BINARY_DIR}/homerun_config.h @ONLY) - -# config/ -install(FILES config/homerunrc DESTINATION ${CONFIG_INSTALL_DIR}) -install(FILES config/homerunkickerrc DESTINATION ${CONFIG_INSTALL_DIR}) - -install(FILES data/favoriteapps.xml DESTINATION ${DATA_INSTALL_DIR}/homerun/) - -add_subdirectory(lib) -add_subdirectory(components) -add_subdirectory(fullscreen) -add_subdirectory(fixes) -#add_subdirectory(tests) -add_subdirectory(icons) -add_subdirectory(kicker) -add_subdirectory(plugins) diff --git a/plasma/applets/homerun/COPYING b/plasma/applets/homerun/COPYING deleted file mode 100644 index bf4cddf2..00000000 --- a/plasma/applets/homerun/COPYING +++ /dev/null @@ -1,14 +0,0 @@ -Individual files should have appropriate license headers. - -libhomerun is licensed under LGPL v2.1 or v3 or later versions approved by the -membership of KDE e.V. - -homerunviewer and the homerun plasma applet are licensed uder GPL v2 or later. - -cmake checks and libhomerun examples are licensed under BSD 2-clause. - -The rest of the code is licensed under either: -- LGPL v2.1 or later -- LGPL v2.1 or v3 or later versions approved by the membership of KDE e.V -- GPL v2 or later -- GPL v2.1 or v3 or later versions approved by the membership of KDE e.V diff --git a/plasma/applets/homerun/LICENSE.BSD b/plasma/applets/homerun/LICENSE.BSD deleted file mode 100644 index 4973d6bc..00000000 --- a/plasma/applets/homerun/LICENSE.BSD +++ /dev/null @@ -1,20 +0,0 @@ -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -SUCH DAMAGE. diff --git a/plasma/applets/homerun/LICENSE.GPL-2 b/plasma/applets/homerun/LICENSE.GPL-2 deleted file mode 100644 index d159169d..00000000 --- a/plasma/applets/homerun/LICENSE.GPL-2 +++ /dev/null @@ -1,339 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. diff --git a/plasma/applets/homerun/LICENSE.LGPL-2.1 b/plasma/applets/homerun/LICENSE.LGPL-2.1 deleted file mode 100644 index 4362b491..00000000 --- a/plasma/applets/homerun/LICENSE.LGPL-2.1 +++ /dev/null @@ -1,502 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! diff --git a/plasma/applets/homerun/Messages.sh b/plasma/applets/homerun/Messages.sh deleted file mode 100644 index 2c217244..00000000 --- a/plasma/applets/homerun/Messages.sh +++ /dev/null @@ -1,4 +0,0 @@ -#! /usr/bin/env bash -$EXTRACTRC `find . -name \*.rc -o -name \*.ui -o -name \*.kcfg` >> rc.cpp -$XGETTEXT `find . -name \*.cpp -o -name \*.qml` -o $podir/plasma_applet_org.kde.homerun.pot -rm -f rc.cpp diff --git a/plasma/applets/homerun/README.md b/plasma/applets/homerun/README.md deleted file mode 100644 index b4ab3ad2..00000000 --- a/plasma/applets/homerun/README.md +++ /dev/null @@ -1,87 +0,0 @@ -# Homerun - -## What is it? - -Homerun is a KDE application launcher and document opener. - -It is a fullscreen launcher with content organized in tabs. A tab is made of -several "sources". A source can provide one or more sections to a tab. Homerun -comes with a few built-in sources, but custom sources can be written using -libhomerun. - -Homerun allows you to start applications, but also to browse hierarchies: for -example clicking on an item of the "Favorite Places" section won't start -Dolphin in this folder: it will list the folder content in Homerun itself, -making it possible to explore the filesystem and directly open the file you are -looking for. In this aspect it can be seen as an alternative to the Folder View -applet. - -Homerun can either be used from a launcher button in a panel, like Kickoff, or -as a containment, like the Search and Launch containment. - -## Dependencies - -kdelibs 4.10 - -## Build instructions - -Homerun currently requires kdelibs and kde-runtime 4.10. - -To build it, do the following: - - mkdir build - cd build - cmake -DCMAKE_INSTALL_PREFIX=`kde4-config --prefix` .. - -Assuming cmake did not complain about missing dependencies, run: - - make - -Then to install it, run as root: - - make install - -## For packagers: Package manager integration - -You can integrate your package manager with Homerun. - -When browsing installed applications by category, Homerun can provide an item to -install more applications from this category. To do so you need to: - -First, create a .desktop file whose Exec= line contains a "@category" placeholder. -This placeholder will be replaced by the category Homerun is browsing. - -For example, here is muon-discover-category.desktop: - - [Desktop Entry] - Name=Install More... - Exec=muon-discover --category @category - Icon=muondiscover - Type=Application - NoDisplay=true - -Then in "homerunrc", "PackageManagement" group, set the value of the -"categoryInstaller" entry to the name of your .desktop file (without the -.desktop extension) - -## Creating your own sources - -It is possible to create your own sources using libhomerun. - -To learn more about libhomerun, run `make dox` to generate the API -documentation. The generated documentation will be in "$BUILDDIR/lib/html". - -You should also have a look at the code of the "helloworld" example source in -"devdoc/helloworld". - -## Getting involved - -You can get in touch with us on IRC: #kde-homerun on Freenode. - -You can report bugs on , product "homerun". - -Clone the git repository with: - - git clone git://anongit.kde.org/homerun - -File review requests on , repository "homerun". diff --git a/plasma/applets/homerun/components/CMakeLists.txt b/plasma/applets/homerun/components/CMakeLists.txt deleted file mode 100644 index b5b252a5..00000000 --- a/plasma/applets/homerun/components/CMakeLists.txt +++ /dev/null @@ -1,79 +0,0 @@ -set(components_SRCS - ${PROJECT_SOURCE_DIR}/internal/aboutdata.cpp - abstractsourceregistry.cpp - action.cpp - actionmanager.cpp - componentsplugin.cpp - globalsettings.cpp - helpmenuactions.cpp - icondialog.cpp - image.cpp - messagebox.cpp - shadoweffect.cpp - sourceconfigurationdialog.cpp - sourcemodel.cpp - sourceregistry.cpp - sources/dir/dirconfigurationwidget.cpp - sources/dir/dirmodel.cpp - sources/favorites/favoriteappsmodel.cpp - sources/favorites/favoriteplacesmodel.cpp - sources/favorites/favoriteutils.cpp - sources/favorites/fileplacesmodel.cpp - sources/favorites/kfileplacesitem.cpp - sources/favorites/kfileplacessharedbookmarks.cpp - sources/installedapps/changenotifier.cpp - sources/installedapps/filterableinstalledappsmodel.cpp - sources/installedapps/groupedinstalledappsmodel.cpp - sources/installedapps/installedappsconfigurationwidget.cpp - sources/installedapps/installedappsmodel.cpp - sources/power/powermodel.cpp - sources/power/combinedpowersessionmodel.cpp - sources/recentapps/recentappsmodel.cpp - sources/runners/querymatchmodel.cpp - sources/runners/singlerunnermodel.cpp - sources/runners/runnerconfigurationwidget.cpp - sources/runners/runnermodel.cpp - sources/session/openedsessionsmodel.cpp - sources/session/sessionmodel.cpp - sources/session/sessionswatcher.cpp - standarditemmodel.cpp - tabmodel.cpp - - sources/dir/dirconfigurationwidget.ui - sources/installedapps/installedappsconfigurationwidget.ui - sources/runners/runnerconfigurationwidget.ui - ) - -include_directories( - ${lib_BINARY_DIR} - ${lib_SOURCE_DIR} - ${PROJECT_SOURCE_DIR}/internal - ${CMAKE_CURRENT_SOURCE_DIR}/sources/dir - ${CMAKE_CURRENT_SOURCE_DIR}/sources/favorites - ${CMAKE_CURRENT_SOURCE_DIR}/sources/installedapps - ${CMAKE_CURRENT_SOURCE_DIR}/sources/power - ${CMAKE_CURRENT_SOURCE_DIR}/sources/recentapps - ${CMAKE_CURRENT_SOURCE_DIR}/sources/runners - ${CMAKE_CURRENT_SOURCE_DIR}/sources/session - ) - -add_library(componentsplugin SHARED ${components_SRCS}) - -target_link_libraries(componentsplugin - ${QT_QTCORE_LIBRARY} - ${QT_QTDECLARATIVE_LIBRARY} - ${KDE4_PLASMA_LIBS} - ${KDE4_KIO_LIBS} - ${KDE4_KFILE_LIBS} - ${KDE4_SOLID_LIBS} - kworkspace - homerun - ) - -install(TARGETS componentsplugin DESTINATION ${IMPORTS_INSTALL_DIR}/org/kde/homerun/components) -install(DIRECTORY qml/ - DESTINATION ${IMPORTS_INSTALL_DIR}/org/kde/homerun/components - PATTERN "*.qml" - PATTERN "qmldir" - PATTERN "*.js" - ) diff --git a/plasma/applets/homerun/components/abstractsourceregistry.cpp b/plasma/applets/homerun/components/abstractsourceregistry.cpp deleted file mode 100644 index 9d9ff823..00000000 --- a/plasma/applets/homerun/components/abstractsourceregistry.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -// Self -#include - -// Local - -// KDE - -// Qt - -namespace Homerun -{ - -AbstractSourceRegistry::AbstractSourceRegistry(QObject *parent) -: QObject(parent) -{} - -AbstractSourceRegistry::~AbstractSourceRegistry() -{ -} - -QObject *AbstractSourceRegistry::createModelFromConfigGroup(const QString &/*sourceId*/, const KConfigGroup &/*configGroup*/, QObject * /*parent*/) -{ - return 0; -} - -} // namespace Homerun - -#include "moc_abstractsourceregistry.cpp" diff --git a/plasma/applets/homerun/components/abstractsourceregistry.h b/plasma/applets/homerun/components/abstractsourceregistry.h deleted file mode 100644 index 73b6b531..00000000 --- a/plasma/applets/homerun/components/abstractsourceregistry.h +++ /dev/null @@ -1,54 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -#ifndef ABSTRACTSOURCEREGISTRY_H -#define ABSTRACTSOURCEREGISTRY_H - -// Local - -// Qt -#include - -// KDE - -class KConfigGroup; - -namespace Homerun -{ - -/** - * Defines the API of the SourceRegistry. Make it possible to mock the - * SourceRegistry in unit-tests. - * - * Methods of this class cannot be pure virtual because AbstractSourceRegistry - * needs to be declared as a QML component to be usable in TabModel. - */ -class AbstractSourceRegistry : public QObject -{ - Q_OBJECT -public: - AbstractSourceRegistry(QObject *parent = 0); - ~AbstractSourceRegistry(); - - virtual QObject *createModelFromConfigGroup(const QString &sourceId, const KConfigGroup &configGroup, QObject *parent); -}; - -} // namespace Homerun - -#endif /* ABSTRACTSOURCEREGISTRY_H */ diff --git a/plasma/applets/homerun/components/action.cpp b/plasma/applets/homerun/components/action.cpp deleted file mode 100644 index 674c368d..00000000 --- a/plasma/applets/homerun/components/action.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* -Copyright 2013 Aurélien Gâteau - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 2 of -the License or (at your option) version 3 or any later version -accepted by the membership of KDE e.V. (or its successor approved -by the membership of KDE e.V.), which shall act as a proxy -defined in Section 14 of version 3 of the license. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ -// Self -#include - -// Local - -// KDE -#include - -// Qt -#include -#include -#include -#include - -Action::Action(QObject *parent) -: KAction(parent) -{ - connect(qApp, SIGNAL(focusChanged(QWidget*,QWidget*)), SLOT(finishInit())); - finishInit(); -} - -void Action::finishInit() -{ - QWidget *widget = QApplication::activeWindow(); - if (!widget) { - return; - } - widget->addAction(this); - disconnect(qApp, SIGNAL(focusChanged(QWidget*,QWidget*)), this, SLOT(finishInit())); -} - -Action::~Action() -{ -} - -QStringList Action::keys() const -{ - return m_keys; -} - -void Action::setKeys(const QStringList &list) -{ - if (m_keys == list) { - return; - } - QList sequenceList; - Q_FOREACH(const QString &txt, list) { - sequenceList.append(QKeySequence::fromString(txt)); - } - setShortcuts(sequenceList); - m_keys = list; - keysChanged(); -} - -#include "moc_action.cpp" diff --git a/plasma/applets/homerun/components/action.h b/plasma/applets/homerun/components/action.h deleted file mode 100644 index 5c52023f..00000000 --- a/plasma/applets/homerun/components/action.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -Copyright 2013 Aurélien Gâteau - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 2 of -the License or (at your option) version 3 or any later version -accepted by the membership of KDE e.V. (or its successor approved -by the membership of KDE e.V.), which shall act as a proxy -defined in Section 14 of version 3 of the license. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ -#ifndef ACTION_H -#define ACTION_H - -// Local - -// Qt - -// KDE -#include - -/** - * Thin QML wrapper around KAction - * - * To be used with ActionManager - * Be sure to define the action objectName(), otherwise ActionManager - * integration will fail! - */ -class Action : public KAction -{ - Q_OBJECT - /** - * Define shortcut keys. Each element of the list is one shortcut. - * Each element is a string using the same format as - * QKeySequence::fromString() - * - * Examples: - * - "Ctrl+PgUp" - * - "Ctrl+PgDown" - * - "Alt+S" - * - "Ctrl+Alt+Left" - */ - Q_PROPERTY(QStringList keys READ keys WRITE setKeys NOTIFY keysChanged) -public: - explicit Action(QObject *parent = 0); - ~Action(); - - QStringList keys() const; - void setKeys(const QStringList &keys); - -Q_SIGNALS: - void keysChanged(); - -private Q_SLOTS: - void finishInit(); - -private: - QStringList m_keys; -}; - -#endif /* ACTION_H */ diff --git a/plasma/applets/homerun/components/actionmanager.cpp b/plasma/applets/homerun/components/actionmanager.cpp deleted file mode 100644 index 8bb76c7b..00000000 --- a/plasma/applets/homerun/components/actionmanager.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/* -Copyright 2013 Aurélien Gâteau - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 2 of -the License or (at your option) version 3 or any later version -accepted by the membership of KDE e.V. (or its successor approved -by the membership of KDE e.V.), which shall act as a proxy -defined in Section 14 of version 3 of the license. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ -// Self -#include - -// Local - -// KDE -#include -#include -#include - -// Qt -#include -#include - -ActionManager::ActionManager(QObject *parent) -: QObject(parent) -, m_readSettingsTimer(new QTimer(this)) -, m_collection(new KActionCollection(this)) -, m_list(this, 0, append) -{ - m_readSettingsTimer->setSingleShot(true); - m_readSettingsTimer->setInterval(0); - connect(m_readSettingsTimer, SIGNAL(timeout()), - SLOT(readSettings())); -} - -ActionManager::~ActionManager() -{ -} - -QDeclarativeListProperty ActionManager::actions() -{ - return m_list; -} - -void ActionManager::append(QDeclarativeListProperty *property, Action *action) -{ - static_cast(property->object)->addAction(action); -} - -void ActionManager::addAction(Action *action) -{ - if (action->objectName().isEmpty()) { - kWarning() << "Cannot add action" << action << "to collection: action.objectName has not been defined"; - return; - } - m_collection->addAction(action->objectName(), action); - m_readSettingsTimer->start(); -} - -void ActionManager::configure() -{ - KShortcutsDialog::configure(m_collection, - KShortcutsEditor::LetterShortcutsAllowed, - QApplication::activeWindow(), - false /* bSaveSettings */); - - m_collection->writeSettings(&m_configGroup); -} - -void ActionManager::readSettings() -{ - if (!m_configGroup.isValid()) { - return; - } - m_collection->readSettings(&m_configGroup); -} - -QString ActionManager::configFileName() const -{ - return m_configFileName; -} - -void ActionManager::setConfigFileName(const QString &name) -{ - if (m_configFileName == name) { - return; - } - m_configFileName = name; - m_configGroup = KSharedConfig::openConfig(m_configFileName)->group("Shortcuts"); - m_readSettingsTimer->start(); - emit configFileNameChanged(); -} - -#include "moc_actionmanager.cpp" diff --git a/plasma/applets/homerun/components/actionmanager.h b/plasma/applets/homerun/components/actionmanager.h deleted file mode 100644 index 7efc6ef4..00000000 --- a/plasma/applets/homerun/components/actionmanager.h +++ /dev/null @@ -1,92 +0,0 @@ -/* -Copyright 2013 Aurélien Gâteau - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 2 of -the License or (at your option) version 3 or any later version -accepted by the membership of KDE e.V. (or its successor approved -by the membership of KDE e.V.), which shall act as a proxy -defined in Section 14 of version 3 of the license. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ -#ifndef ACTIONMANAGER_H -#define ACTIONMANAGER_H - -// Local -#include - -// Qt -#include - -// KDE -#include -#include - -class QTimer; - -/** - * Handles a list of Action items, make it possible to configure their shortcuts. - * - * Quite similar to KActionCollection, but does not directly expose a - * KActionCollection. - * - * Usage: - * ActionManager { - * id: actionManager - * configFileName: "myapprc" - * Action { - * ... - * } - * Action { - * ... - * } - * ... - * } - * - * To configure action shortcuts: - * - * actionManager.configure() - */ -class ActionManager : public QObject -{ - Q_OBJECT - Q_PROPERTY(QDeclarativeListProperty actions READ actions) - Q_PROPERTY(QString configFileName READ configFileName WRITE setConfigFileName NOTIFY configFileNameChanged) - Q_CLASSINFO("DefaultProperty", "actions") -public: - explicit ActionManager(QObject *parent = 0); - ~ActionManager(); - - QDeclarativeListProperty actions(); - - Q_INVOKABLE void configure(); - - QString configFileName() const; - void setConfigFileName(const QString &name); - -Q_SIGNALS: - void configFileNameChanged(); - -private Q_SLOTS: - void readSettings(); - -private: - QTimer *m_readSettingsTimer; - KActionCollection *m_collection; - QDeclarativeListProperty m_list; - QString m_configFileName; - KConfigGroup m_configGroup; - - void addAction(Action *action); - static void append(QDeclarativeListProperty *property, Action *action); -}; - -#endif /* ACTIONMANAGER_H */ diff --git a/plasma/applets/homerun/components/componentsplugin.cpp b/plasma/applets/homerun/components/componentsplugin.cpp deleted file mode 100644 index 5324e1e0..00000000 --- a/plasma/applets/homerun/components/componentsplugin.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2012 Shaun Reich - * Copyright 2012 by Aurélien Gâteau - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "componentsplugin.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -void ComponentsPlugin::registerTypes(const char *uri) -{ - Q_ASSERT(uri == QLatin1String("org.kde.homerun.components")); - qmlRegisterType(uri, 0, 1, "Action"); - qmlRegisterType(uri, 0, 1, "ActionManager"); - qmlRegisterType(uri, 0, 1, "ShadowEffect"); - qmlRegisterType(uri, 0, 1, "GlobalSettings"); - qmlRegisterType(uri, 0, 1, "HelpMenuActions"); - qmlRegisterType(uri, 0, 1, "IconDialog"); - qmlRegisterType(uri, 0, 1, "Image"); - qmlRegisterType(uri, 0, 1, "MessageBox"); - qmlRegisterType(uri, 0, 1, "AbstractSourceRegistry"); - qmlRegisterType(uri, 0, 1, "SourceRegistry"); - qmlRegisterType(uri, 0, 1, "TabModel"); -} - -#include "moc_componentsplugin.cpp" diff --git a/plasma/applets/homerun/components/componentsplugin.h b/plasma/applets/homerun/components/componentsplugin.h deleted file mode 100644 index 2ff83121..00000000 --- a/plasma/applets/homerun/components/componentsplugin.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2011 by Marco Martin - * Copyright 2011 by Aaron Seigo - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef COMPONENTSPLUGIN_H -#define COMPONENTSPLUGIN_H - -#include - - -class ComponentsPlugin : public QDeclarativeExtensionPlugin -{ - Q_OBJECT - -public: - void registerTypes(const char *uri); -}; - -Q_EXPORT_PLUGIN2(componentsplugin, ComponentsPlugin) - -#endif diff --git a/plasma/applets/homerun/components/customtypes.h b/plasma/applets/homerun/components/customtypes.h deleted file mode 100644 index bccbe215..00000000 --- a/plasma/applets/homerun/components/customtypes.h +++ /dev/null @@ -1,30 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -#ifndef CUSTOMTYPES_H -#define CUSTOMTYPES_H - -// KDE -#include - -// We use KConfigGroup* and not KConfigGroup because if using the later, one -// gets an invalid group from the QVariant -Q_DECLARE_METATYPE(KConfigGroup*) - -#endif /* CUSTOMTYPES_H */ diff --git a/plasma/applets/homerun/components/globalsettings.cpp b/plasma/applets/homerun/components/globalsettings.cpp deleted file mode 100644 index d59cc458..00000000 --- a/plasma/applets/homerun/components/globalsettings.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/* -Copyright 2013 Eike Hein - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 2 of -the License or (at your option) version 3 or any later version -accepted by the membership of KDE e.V. (or its successor approved -by the membership of KDE e.V.), which shall act as a proxy -defined in Section 14 of version 3 of the license. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ -// Self -#include - -// Local - -// KDE -#include -#include - -GlobalSettings::GlobalSettings(QObject *parent) : QObject(parent) -{ -} - -GlobalSettings::~GlobalSettings() -{ -} - -QString GlobalSettings::configFileName() const -{ - return m_configFileName; -} - -void GlobalSettings::setConfigFileName(const QString &name) -{ - if (m_configFileName == name) { - return; - } - - m_configFileName = name; - m_configGroup = KSharedConfig::openConfig(m_configFileName)->group("Global"); - emit configFileNameChanged(); - emit showActionListOverlayChanged(); - emit showDesktopToolBoxChanged(); -} - -bool GlobalSettings::showActionListOverlay() const -{ - if (!m_configGroup.isValid()) { - return false; - } - return m_configGroup.readEntry("ShowActionListOverlay", false); -} - -void GlobalSettings::setShowActionListOverlay(bool show) -{ - if (show == showActionListOverlay()) { - return; - } - - if (m_configGroup.isValid()) { - m_configGroup.writeEntry("ShowActionListOverlay", show); - m_configGroup.sync(); - emit showActionListOverlayChanged(); - } -} - -bool GlobalSettings::showDesktopToolBox() const -{ - if (!m_configGroup.isValid()) { - return false; - } - return m_configGroup.readEntry("ShowDesktopToolBox", false); -} - -void GlobalSettings::setShowDesktopToolBox(bool show) -{ - if (show == showDesktopToolBox()) { - return; - } - - if (m_configGroup.isValid()) { - m_configGroup.writeEntry("ShowDesktopToolBox", show); - m_configGroup.sync(); - emit showDesktopToolBoxChanged(); - } -} - -#include "moc_globalsettings.cpp" diff --git a/plasma/applets/homerun/components/globalsettings.h b/plasma/applets/homerun/components/globalsettings.h deleted file mode 100644 index 6100cd5c..00000000 --- a/plasma/applets/homerun/components/globalsettings.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -Copyright 2013 Eike Hein - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 2 of -the License or (at your option) version 3 or any later version -accepted by the membership of KDE e.V. (or its successor approved -by the membership of KDE e.V.), which shall act as a proxy -defined in Section 14 of version 3 of the license. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ -#ifndef GLOBALSETTINGS_H -#define GLOBALSETTINGS_H - -// Qt -#include - -// KDE -#include - -class GlobalSettings : public QObject -{ - Q_OBJECT - Q_PROPERTY(QString configFileName READ configFileName WRITE setConfigFileName NOTIFY configFileNameChanged) - Q_PROPERTY(bool showActionListOverlay READ showActionListOverlay WRITE setShowActionListOverlay NOTIFY showActionListOverlayChanged) - Q_PROPERTY(bool showDesktopToolBox READ showDesktopToolBox WRITE setShowDesktopToolBox NOTIFY showDesktopToolBoxChanged) -public: - explicit GlobalSettings(QObject *parent = 0); - ~GlobalSettings(); - - QString configFileName() const; - void setConfigFileName(const QString &name); - - bool showActionListOverlay() const; - void setShowActionListOverlay(bool show); - - bool showDesktopToolBox() const; - void setShowDesktopToolBox(bool show); - -Q_SIGNALS: - void configFileNameChanged(); - void showActionListOverlayChanged(); - void showDesktopToolBoxChanged(); - -private: - QString m_configFileName; - KConfigGroup m_configGroup; -}; - -#endif /* GLOBALSETTINGS_H */ diff --git a/plasma/applets/homerun/components/helpmenuactions.cpp b/plasma/applets/homerun/components/helpmenuactions.cpp deleted file mode 100644 index f698cc05..00000000 --- a/plasma/applets/homerun/components/helpmenuactions.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -// Self -#include - -// Local - -// KDE -#include - -// Qt -#include -#include - -// Local -#include - -HelpMenuActions::HelpMenuActions(QObject *parent) -: QObject(parent) -, m_menu(0) -, m_aboutData(0) -{ -} - -HelpMenuActions::~HelpMenuActions() -{ - delete m_menu; - delete m_aboutData; -} - -QString HelpMenuActions::text(HelpMenuActions::ActionId actionId) -{ - QAction *act = action(actionId); - Q_ASSERT(act); - return act->text(); -} - -void HelpMenuActions::trigger(HelpMenuActions::ActionId actionId) -{ - QAction *act = action(actionId); - Q_ASSERT(act); - act->trigger(); -} - -QAction *HelpMenuActions::action(HelpMenuActions::ActionId actionId) -{ - if (!m_menu) { - m_aboutData = HomerunInternal::createAboutData(); - m_menu = new KHelpMenu(QApplication::activeWindow(), m_aboutData); - // Call menu() to cause the actions to be created - m_menu->menu(); - } - return m_menu->action(static_cast(actionId)); -} - -#include "moc_helpmenuactions.cpp" diff --git a/plasma/applets/homerun/components/helpmenuactions.h b/plasma/applets/homerun/components/helpmenuactions.h deleted file mode 100644 index 7176da39..00000000 --- a/plasma/applets/homerun/components/helpmenuactions.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -#ifndef HELPMENUACTIONS_H -#define HELPMENUACTIONS_H - -// Local - -// Qt - -// KDE -#include - -/** - * Wrapper exposing KHelpMenu actions - */ -class HelpMenuActions : public QObject -{ - Q_OBJECT - Q_ENUMS(ActionId) -public: - explicit HelpMenuActions(QObject *parent = 0); - ~HelpMenuActions(); - - enum ActionId { - AboutApplication = KHelpMenu::menuAboutApp, - AboutKDE = KHelpMenu::menuAboutKDE, - ReportBug = KHelpMenu::menuReportBug, - SwitchLanguage = KHelpMenu::menuSwitchLanguage, - }; - - Q_INVOKABLE QString text(ActionId); - Q_INVOKABLE void trigger(ActionId); - -private: - KHelpMenu *m_menu; - KAboutData *m_aboutData; - - QAction *action(ActionId); -}; - -#endif /* HELPMENUACTIONS_H */ diff --git a/plasma/applets/homerun/components/icondialog.cpp b/plasma/applets/homerun/components/icondialog.cpp deleted file mode 100644 index 2b2adf99..00000000 --- a/plasma/applets/homerun/components/icondialog.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -// Self -#include - -// Local - -// KDE -#include - -// Qt -#include - -IconDialog::IconDialog(QObject *parent) -: QObject(parent) -{ -} - -QString IconDialog::getIcon() -{ - KIconDialog dialog(QApplication::activeWindow()); - dialog.setup( - KIconLoader::Small /* group */, - KIconLoader::Category /* context */, - true /* strictIconSize */ - ); - return dialog.openDialog(); -} - -#include "moc_icondialog.cpp" diff --git a/plasma/applets/homerun/components/icondialog.h b/plasma/applets/homerun/components/icondialog.h deleted file mode 100644 index 00e8d0cc..00000000 --- a/plasma/applets/homerun/components/icondialog.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -#ifndef ICONDIALOG_H -#define ICONDIALOG_H - -// Local - -// Qt -#include - -// KDE - -/** - * A simplistic QML wrapper for KIconDialog - */ -class IconDialog : public QObject -{ - Q_OBJECT -public: - explicit IconDialog(QObject *parent = 0); - - Q_INVOKABLE QString getIcon(); -}; - -#endif /* ICONDIALOG_H */ diff --git a/plasma/applets/homerun/components/image.cpp b/plasma/applets/homerun/components/image.cpp deleted file mode 100644 index f4fe0fed..00000000 --- a/plasma/applets/homerun/components/image.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/* -Copyright 2013 Aurélien Gâteau - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 2 of -the License or (at your option) version 3 or any later version -accepted by the membership of KDE e.V. (or its successor approved -by the membership of KDE e.V.), which shall act as a proxy -defined in Section 14 of version 3 of the license. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ -// Self -#include - -// Local - -// KDE -#include -#include - -// Qt -#include -#include - -Image::Image(QDeclarativeItem *parent) -: QDeclarativeItem(parent) -{ - setFlag(QGraphicsItem::ItemHasNoContents, false); -} - -Image::~Image() -{ -} - -QVariant Image::source() const -{ - return m_source; -} - -void Image::setSource(const QVariant &source) -{ - if (source == m_source) { - return; - } - m_source = source; - reload(); - sourceChanged(); -} - -void Image::reload() -{ - const int extent = qMin(width(), height()); - if (m_source.canConvert()) { - KIcon icon(m_source.toString()); - m_pixmap = icon.pixmap(extent); - } else if (m_source.canConvert()) { - QIcon icon = m_source.value(); - m_pixmap = icon.pixmap(extent); - } else { - if (m_source.isValid()) { - kWarning() << "Don't know how to handle source" << m_source; - } - m_pixmap = QPixmap(); - } - // Always update, even if we do not have valid content. If we had content - // before, we need to erase it. - update(); -} - -void Image::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) -{ - if (newGeometry.size() != oldGeometry.size()) { - reload(); - } -} - -void Image::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *) -{ - if (m_pixmap.isNull()) { - return; - } - const QRect &rect = option->rect; - painter->drawPixmap( - rect.x() + (rect.width() - m_pixmap.width())/ 2, - rect.y() + (rect.height() - m_pixmap.height()) / 2, - m_pixmap); -} - - -#include "moc_image.cpp" diff --git a/plasma/applets/homerun/components/image.h b/plasma/applets/homerun/components/image.h deleted file mode 100644 index 247141e6..00000000 --- a/plasma/applets/homerun/components/image.h +++ /dev/null @@ -1,61 +0,0 @@ -/* -Copyright 2013 Aurélien Gâteau - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 2 of -the License or (at your option) version 3 or any later version -accepted by the membership of KDE e.V. (or its successor approved -by the membership of KDE e.V.), which shall act as a proxy -defined in Section 14 of version 3 of the license. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ -#ifndef IMAGE_H -#define IMAGE_H - -// Local - -// Qt -#include - -// KDE - -/** - * An item which shows images whose sources can be either the name of an icon - * or a QIcon. - */ -class Image : public QDeclarativeItem -{ - Q_OBJECT - - Q_PROPERTY(QVariant source READ source WRITE setSource NOTIFY sourceChanged) -public: - explicit Image(QDeclarativeItem *parent = 0); - ~Image(); - - QVariant source() const; - void setSource(const QVariant &value); - - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override; - -Q_SIGNALS: - void sourceChanged(); - -protected: - void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override; - -private: - QVariant m_source; - QPixmap m_pixmap; - - void reload(); -}; - -#endif /* IMAGE_H */ diff --git a/plasma/applets/homerun/components/messagebox.cpp b/plasma/applets/homerun/components/messagebox.cpp deleted file mode 100644 index 662d6289..00000000 --- a/plasma/applets/homerun/components/messagebox.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* -Copyright 2013 Aurélien Gâteau - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 2 of -the License or (at your option) version 3 or any later version -accepted by the membership of KDE e.V. (or its successor approved -by the membership of KDE e.V.), which shall act as a proxy -defined in Section 14 of version 3 of the license. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ -// Self -#include - -// Local - -// KDE - -// Qt -#include - -MessageBox::MessageBox(QObject *parent) -: QObject(parent) -{ -} - -int MessageBox::warningContinueCancel(const QString& text, const QString& caption, const QString& continueText, const QString& cancelText) -{ - KGuiItem cont = continueText.isEmpty() ? KStandardGuiItem::cont() : KGuiItem(continueText); - KGuiItem cancel = cancelText.isEmpty() ? KStandardGuiItem::cancel() : KGuiItem(cancelText); - int ret = KMessageBox::warningContinueCancel(QApplication::activeWindow(), - text, caption, cont, cancel); - - return ret; -} - -#include "moc_messagebox.cpp" diff --git a/plasma/applets/homerun/components/messagebox.h b/plasma/applets/homerun/components/messagebox.h deleted file mode 100644 index 2d58876b..00000000 --- a/plasma/applets/homerun/components/messagebox.h +++ /dev/null @@ -1,60 +0,0 @@ -/* -Copyright 2013 Aurélien Gâteau - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 2 of -the License or (at your option) version 3 or any later version -accepted by the membership of KDE e.V. (or its successor approved -by the membership of KDE e.V.), which shall act as a proxy -defined in Section 14 of version 3 of the license. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ -#ifndef MESSAGEBOX_H -#define MESSAGEBOX_H - -// Local - -// Qt -#include - -// KDE -#include - -/** - * Wrapper around KMessageBox - */ -class MessageBox : public QObject -{ - Q_OBJECT - Q_ENUMS(ButtonCode) -public: - explicit MessageBox(QObject *parent = 0); - - enum ButtonCode { - Ok = KMessageBox::Ok, - Cancel = KMessageBox::Cancel, - Yes = KMessageBox::Yes, - No = KMessageBox::No, - Continue = KMessageBox::Continue, - }; - - /** - * Return value is a MessageBox::ButtonCode - */ - Q_INVOKABLE int warningContinueCancel( - const QString &text, - const QString &caption = QString(), - const QString &continueText = QString(), - const QString &cancelText = QString() - ); -}; - -#endif /* MESSAGEBOX_H */ diff --git a/plasma/applets/homerun/components/qml/ActionMenu.qml b/plasma/applets/homerun/components/qml/ActionMenu.qml deleted file mode 100644 index 5151d56d..00000000 --- a/plasma/applets/homerun/components/qml/ActionMenu.qml +++ /dev/null @@ -1,103 +0,0 @@ -/* -Copyright 2013 Aurélien Gâteau - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -import QtQuick 1.1 - -import org.kde.plasma.components 0.1 as PlasmaComponents - -Item { - id: main - /// Public - - /// type:list> list of actions - property variant actionList - - property Item visualParent - - property bool opened: menu ? (menu.status != PlasmaComponents.DialogStatus.Closed) : false - - signal actionClicked(string actionId, variant actionArgument) - - function open(x, y) { - if (x && y) { - menu.open(x, y); - } else { - menu.open(); - } - } - - /// Internal - property QtObject menu - - Component { - id: contextMenuComponent - PlasmaComponents.ContextMenu { - visualParent: main.visualParent - } - } - - Component { - id: contextMenuItemComponent - - PlasmaComponents.MenuItem { - property variant actionItem - - text: actionItem.text ? actionItem.text : "" - enabled: actionItem.type != "title" && ("enabled" in actionItem ? actionItem.enabled : true) - separator: actionItem.type == "separator" - icon: actionItem.icon ? actionItem.icon : null - - onClicked: { - actionClicked(actionItem.actionId, actionItem.actionArgument); - } - } - } - - Component { - id: emptyMenuItemComponent - PlasmaComponents.MenuItem { - text: i18n("(Empty)") - enabled: false - } - } - - // Code - onActionListChanged: refreshMenu(); - - function refreshMenu() { - if (menu) { - menu.destroy(); - } - - menu = contextMenuComponent.createObject(main); - - if (!actionList || actionList.length == 0) { - var item = emptyMenuItemComponent.createObject(menu); - menu.addMenuItem(item); - return; - } - - actionList.forEach(function(actionItem) { - var item = contextMenuItemComponent.createObject(menu, { - "actionItem": actionItem, - }); - menu.addMenuItem(item); - }); - } -} diff --git a/plasma/applets/homerun/components/qml/DragArea.qml b/plasma/applets/homerun/components/qml/DragArea.qml deleted file mode 100644 index 475437f5..00000000 --- a/plasma/applets/homerun/components/qml/DragArea.qml +++ /dev/null @@ -1,170 +0,0 @@ -/* -Copyright 2013 Aurélien Gâteau - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -import QtQuick 1.1 - -Item { - id: main - property Item dragContainer - property Item draggedItem: parent - property int itemIndex: -1 - - property alias hoverEnabled: mouseArea.hoverEnabled - property bool dragEnabled: true - - // Read only info - property bool isHoldDown: mouseArea.holdX > -1 - property bool isDragged: dragContainer.draggedIndex != -1 && itemIndex == dragContainer.draggedIndex - - property alias mouseX: mouseArea.mouseX - property alias mouseY: mouseArea.mouseY - property alias containsMouse: mouseArea.containsMouse - - /** - * type:Qt::MouseButtons accepted buttons - * - * MiddleButton is already used for dragging, so you can't react to middle button - */ - property int acceptedButtons - - /** - * @param type:MouseEvent mouse Mouse event for the click - */ - signal clicked(variant mouse) - - signal longPressTimeReached() - - /** - * Emitted when user pressed the item for a long time and released it. - * This is a good opportunity to show a context menu. - */ - signal longPressReleased() - - // Internal - property Item oldParent - - MouseArea { - id: mouseArea - acceptedButtons: main.acceptedButtons | Qt.MiddleButton - anchors.fill: parent - - property real holdX: -1 - property real holdY: -1 - - onPressAndHold: { - holdX = mouseX; - holdY = mouseY; - longPressTimeReached(); - } - - onPressed: { - if (main.dragEnabled && mouse.button == Qt.MiddleButton) { - main.startDrag(); - mouse.accepted = true; - } - } - - onPositionChanged: { - function moved(a, b) { - return Math.abs(a, b) > 16; - } - if (!main.dragEnabled) { - if (isHoldDown) { - resetHold(); - } - return; - } - // We only reach this point when drag is enabled - if (main.isHoldDown && (moved(mouseX, holdX) || moved(mouseY, holdY))) { - resetHold(); - main.startDrag(); - return; - } - if (main.isDragged) { - main.updateDrag(); - } - } - - onReleased: { - if (main.isHoldDown) { - resetHold(); - longPressReleased(); - return; - } - if (isDragged) { - stopDrag(); - } - } - - onClicked: { - main.clicked(mouse); - } - - function resetHold() { - holdX = -1; - holdY = -1; - } - } - - function startDrag() { - if (isDragged) { - return; - } - dragContainer.draggedIndex = itemIndex; - oldParent = draggedItem.parent; - - // Move draggedItem to dragContainer, keeping its position unchanged - var coord = dragContainer.mapFromItem(main, 0, 0); - draggedItem.parent = dragContainer; - draggedItem.x = coord.x; - draggedItem.y = coord.y; - - mouseArea.drag.target = draggedItem; - } - - function updateDrag() { - var coord = dragContainer.mapFromItem(draggedItem, draggedItem.width / 2, draggedItem.height / 2); - var newIndex = dragContainer.indexAt(coord.x, coord.y); - - if (dragContainer.draggedIndex != -1 && newIndex != -1 && newIndex != dragContainer.draggedIndex) { - if ("move" in dragContainer.model) { - dragContainer.model.move(dragContainer.draggedIndex, newIndex, 1); - } else if ("moveRow" in dragContainer.model) { - dragContainer.model.moveRow(dragContainer.draggedIndex, newIndex); - } else { - console.log("DragArea.updateDrag(): ERROR: Don't know how to move rows for model " + dragContainer.model); - stopDrag(); - return; - } - dragContainer.draggedIndex = newIndex; - } - } - - function stopDrag() { - dragContainer.draggedIndex = -1; - - // Move draggedItem back to its old parent - draggedItem.parent = oldParent; - draggedItem.x = 0; - draggedItem.y = 0; - oldParent = null; - - mouseArea.drag.target = null; - } -} diff --git a/plasma/applets/homerun/components/qml/DragContainer.qml b/plasma/applets/homerun/components/qml/DragContainer.qml deleted file mode 100644 index fd16fb8d..00000000 --- a/plasma/applets/homerun/components/qml/DragContainer.qml +++ /dev/null @@ -1,30 +0,0 @@ -/* -Copyright 2013 Aurélien Gâteau - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -import QtQuick 1.1 - -Item { - property QtObject model - - property int draggedIndex: -1 - - function indexAt(viewX, viewY) { - return parent.indexAt(parent.contentX + viewX, parent.contentY + viewY); - } -} diff --git a/plasma/applets/homerun/components/qml/Label.qml b/plasma/applets/homerun/components/qml/Label.qml deleted file mode 100644 index 551c389a..00000000 --- a/plasma/applets/homerun/components/qml/Label.qml +++ /dev/null @@ -1,68 +0,0 @@ -/* -Copyright 2013 Aurélien Gâteau - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 2 of -the License or (at your option) version 3 or any later version -accepted by the membership of KDE e.V. (or its successor approved -by the membership of KDE e.V.), which shall act as a proxy -defined in Section 14 of version 3 of the license. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ -import QtQuick 1.1 -import org.kde.homerun.components 0.1 as HomerunComponents -import org.kde.plasma.components 0.1 as PlasmaComponents - -/** - * A label which uses Plasma colors by default, but appears differently when - * run as a containment: it shows a shadow behind itself and both shadow and - * text colors can be customized. - */ -PlasmaComponents.Label { - id: main - - Component { - id: shadowComponent - HomerunComponents.ShadowEffect { - xOffset: 0 - yOffset: 1 - blurRadius: 2 - } - } - - Component.onCompleted: { - var isContainment = "plasmoid" in this; - if (isContainment) { - readConfig(); - plasmoid.addEventListener("ConfigChanged", readConfig); - } else { - main.color = theme.textColor; - } - } - - function readConfig() { - main.color = plasmoid.readConfig("textColor"); - if (plasmoid.readConfig("shadowModeNone") == true) { - if (main.effect) { - main.effect.destroy(); - } - return; - } - if (!main.effect) { - main.effect = shadowComponent.createObject(main); - } - if (plasmoid.readConfig("shadowModeCustom") == true) { - main.effect.color = plasmoid.readConfig("shadowColor"); - } else { - main.effect.resetColor(); - } - } -} diff --git a/plasma/applets/homerun/components/qml/TabBar.qml b/plasma/applets/homerun/components/qml/TabBar.qml deleted file mode 100644 index 73b164a7..00000000 --- a/plasma/applets/homerun/components/qml/TabBar.qml +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright 2012 Aurélien Gâteau - * - * Based on TabBar.qml from KDE Plasma Components. - * - *- Start of KDE Plasma Components TabBar.qml copyright header --------- - * - * Copyright 2011 Marco Martin - * - * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * Contact: Nokia Corporation (qt-info@nokia.com) - * - * This file is part of the Qt Components project. - * - * $QT_BEGIN_LICENSE:BSD$ - * You may use this file under the terms of the BSD license as follows: - * - * "Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor - * the names of its contributors may be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." - * - *- End of KDE Plasma Components TabBar.qml copyright header ------------ - */ - -import QtQuick 1.1 -import org.kde.plasma.core 0.1 as PlasmaCore -import org.kde.plasma.components 0.1 - -Item { - id: root - - height: frame.margins.top - + buttonFrame.margins.top - + theme.smallIconSize - + buttonFrame.margins.bottom - + frame.margins.bottom - - property alias model: listView.model - property alias delegate: listView.delegate - property alias currentIndex: listView.currentIndex - property alias currentItem: listView.currentItem - property alias count: listView.count - - function incrementCurrentIndex() { - listView.incrementCurrentIndex(); - } - - function decrementCurrentIndex() { - listView.decrementCurrentIndex(); - } - - property alias buttonFrame: listView.buttonFrame - - PlasmaCore.FrameSvgItem { - id: frame - - anchors.fill: parent - imagePath: "widgets/frame" - prefix: "sunken" - - ListView { - id: listView - - // Hack: make it possible for other elements to know the margins - // of the highlight item before it is created - property Item buttonFrame: PlasmaCore.FrameSvgItem { - imagePath: "widgets/button" - prefix: "normal" - visible: false - } - - anchors { - left: parent.left - top: parent.top - right: parent.right - bottom: parent.bottom - leftMargin: frame.margins.left - topMargin: frame.margins.top - rightMargin: frame.margins.right - bottomMargin: frame.margins.bottom - } - - orientation: ListView.Horizontal - - highlightMoveDuration: 250 - highlightResizeDuration: 250 - - highlight: PlasmaCore.FrameSvgItem { - imagePath: "widgets/button" - prefix: "normal" - height: parent ? parent.height : 0 - } - - currentIndex: 0 - } - } -} diff --git a/plasma/applets/homerun/components/qml/TabButton.qml b/plasma/applets/homerun/components/qml/TabButton.qml deleted file mode 100644 index 50e52cbe..00000000 --- a/plasma/applets/homerun/components/qml/TabButton.qml +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Copyright 2012 Aurélien Gâteau - * - * Based on TabBar.qml from KDE Plasma Components. - * - *- Start of KDE Plasma Components TabBar.qml copyright header --------- - * - * Copyright 2011 Marco Martin - * - * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * Contact: Nokia Corporation (qt-info@nokia.com) - * - * This file is part of the Qt Components project. - * - * $QT_BEGIN_LICENSE:BSD$ - * You may use this file under the terms of the BSD license as follows: - * - * "Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor - * the names of its contributors may be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." - * $QT_END_LICENSE$ - * - *- End of KDE Plasma Components TabBar.qml copyright header ------------ - */ - -/**Documented API -Inherits: - Item - -Imports: - QtQuick 1.1 - AppManager.js - -Description: - A simple tab button which is using the plasma theme. - -Properties: - Item tab: - The reference to the tab content (one of the children of a TabGroup, - usually a Page) that is activated when this TabButton is clicked. - - bool checked: - True if the button is checked,otherwise false. - - bool pressed: - True if the button is being pressed,otherwise false. - - string text: - Sets the text for the button. - - string iconSource: - Icon for the button. It can be a Freedesktop icon name, a full path to a ong/svg file, - or any name for which the application has an image handler registered. - -Signals: - onClicked: - The signal is emmited when the button is clicked. -**/ - -import QtQuick 1.1 -import org.kde.plasma.components 0.1 as PlasmaComponents -import "private" as Private - -Item { - id: root - - // Common Public API - property Item tab - property int index - - property bool pressed: mouseArea.pressed == true && mouseArea.containsMouse - property alias text: label.text - property alias iconSource: imageLoader.source - - property alias rightSide: rightSideItems.data - - property int iconSpacing: 4 - - property int topMargin: ListView.view.buttonFrame.margins.top - property int bottomMargin: ListView.view.buttonFrame.margins.bottom - property int leftMargin: ListView.view.buttonFrame.margins.left - property int rightMargin: ListView.view.buttonFrame.margins.right - - width: ListView.view.width / ListView.view.count - - implicitWidth: label.implicitWidth + (iconSource != null ? imageLoader.implicitWidth + iconSpacing : 0) - implicitHeight: (iconSource === null - ? label.implicitHeight - : Math.max(label.implicitHeight, imageLoader.implicitHeight) - ) + topMargin + bottomMargin - - opacity: enabled ? 1 : 0.6 - - Private.IconLoader { - id: imageLoader - - implicitWidth: theme.smallIconSize - implicitHeight: implicitWidth - - anchors { - left: parent.left - leftMargin: leftMargin - verticalCenter: parent.verticalCenter - } - } - - /* - HACK: We use a HomerunComponents.Label for the normal text and - a PlasmaComponents.Label for the current text. - - This is necessary for containment mode: - It makes it possible to have custom color + shadow for normal text (to - ensure it remains readable) and buttonTextColor + no-shadow for button text - (because it is drawn on top of a button frame) - */ - Label { - id: label - - objectName: "label" - - anchors { - top: parent.top - left: iconSource == null ? parent.left : imageLoader.right - leftMargin: iconSource == null ? leftMargin : iconSpacing - right: rightSideItems.left - bottom: parent.bottom - } - - elide: Text.ElideRight - horizontalAlignment: Text.AlignLeft - verticalAlignment: Text.AlignVCenter - - color: theme.textColor - opacity: root.ListView.isCurrentItem ? 0 : 1 - Behavior on opacity { NumberAnimation { duration: 250 }} - } - - PlasmaComponents.Label { - id: currentLabel - text: label.text - - anchors.fill: label - - elide: label.elide - horizontalAlignment: label.horizontalAlignment - verticalAlignment: label.verticalAlignment - - color: theme.buttonTextColor - opacity: root.ListView.isCurrentItem ? 1 : 0 - Behavior on opacity { NumberAnimation { duration: 250 }} - } - - MouseArea { - id: mouseArea - - onClicked: { - root.ListView.view.currentIndex = root.index; - } - - anchors { - top: parent.top - left: parent.left - right: label.right - bottom: parent.bottom - } - } - - Row { - id: rightSideItems - anchors { - top: parent.top - right: parent.right - bottom: parent.bottom - } - } -} diff --git a/plasma/applets/homerun/components/qml/TabGroup.qml b/plasma/applets/homerun/components/qml/TabGroup.qml deleted file mode 100644 index aebe7a15..00000000 --- a/plasma/applets/homerun/components/qml/TabGroup.qml +++ /dev/null @@ -1,274 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Components project. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/**Documented API -Inherits: - Item - -Imports: - QtQuick 1.1 - -Description: - Provides a set of pages for a tab-based interface. - A tabbed interface is made up of tab buttons plus content for each button. A TabGroup component has, as its children, each page of content in the interface. These pages can be any QML items but are typically Page components for a single page of content or PageStack components when a hierarchical navigation system is required for the tab content. - If you use Page components for your tab content, the status property of each page is updated appropriately when the current tab is changed: the current page has status PageStatus.Active and other pages have the status PageStatus.Inactive. During page transitions, PageStatus.Activating (for the page that is becoming the current page) and PageStatus.Deactivating (for the page that was the current page) statuses are also set. - -Properties: - Item currentTab: - The tab that is currently active and visible to the user. - The currentTab property is initialized to null and is automatically set to point to the first tab when content is added. You can set the currentTab at any time to activate a particular tab. - -**/ - -import QtQuick 1.1 -import "private/TabGroup.js" as Engine - -import "." 0.1 - -Item { - id: root - property Item currentTab - - property list privateContents - // Qt defect: cannot have list as default property - default property alias privateContentsDefault: root.privateContents - - onChildrenChanged: { - // [0] is containerHost - if (children.length > 1) - Engine.addTab(children[1]) - } - - onPrivateContentsChanged: { - Engine.ensureContainers() - } - - Component.onCompleted: { - // Set first tabs as current if currentTab is not set by application - if (currentTab == null && containerHost.children[0] && containerHost.children[0].children[0]) - currentTab = containerHost.children[0].children[0] - priv.complete = true; - } - - Item { - id: containerHost - objectName: "containerHost" - anchors.fill: parent - } - - Component { - id: tabContainerComponent - Item { - id: tabContainerItem - - onChildrenChanged: { - if (children.length == 0) - Engine.removeContainer(tabContainerItem) - - else if (children.length == 1) { - children[0].width = width - children[0].height = height - // tab content created. set the first tab as current (if not set before, and if - // child is added after TabGroup has completed) - if (priv.complete && root.currentTab == null) - root.currentTab = children[0] - } - } - - onWidthChanged: { - if (children.length > 0) - children[0].width = width - } - - onHeightChanged: { - if (children.length > 0) - children[0].height = height - } - - Component.onDestruction: { - if (typeof(root) != "undefined" && !root.currentTab) { - // selected one deleted. try to activate the neighbour - var removedIndex = -1 - for (var i = 0; i < containerHost.children.length; i++) { - if (containerHost.children[i] == tabContainerItem) { - removedIndex = i - break - } - } - var newIndex = -1 - if (removedIndex != -1) { - if (removedIndex != containerHost.children.length - 1) - newIndex = removedIndex + 1 - else if (removedIndex != 0) - newIndex = removedIndex - 1 - } - - if (newIndex != -1) - root.currentTab = containerHost.children[newIndex].children[0] - else - root.currentTab = null - } - } - - function incomingDone() { - state = "" - if (priv.incomingPage) { - if (priv.incomingPage.status != undefined) { - priv.incomingPage.status = PageStatus.Active - } - priv.incomingPage = null - } - } - - function outgoingDone() { - if (priv.outgoingPage) { - if (priv.outgoingPage.status != undefined) { - priv.outgoingPage.status = PageStatus.Active - } - priv.outgoingPage.visible = false - priv.outgoingPage = null - } - state = "HiddenLeft" - } - - width: parent ? parent.width : 0 - height: parent ? parent.height : 0 - state: "HiddenLeft" - - states: [ - State { name: ""; PropertyChanges { target: tabContainerItem; opacity: 1.0; x: 0 } }, - State { name: "Incoming"; PropertyChanges { target: tabContainerItem; opacity: 1.0; x: 0 } }, - - State { - name: "OutgoingLeft" - PropertyChanges { - target: tabContainerItem - opacity: 0.0 - x: -root.width - } - }, - State { - name: "OutgoingRight" - PropertyChanges { - target: tabContainerItem - opacity: 0.0 - x: root.width - } - }, - - State { name: "HiddenLeft"; PropertyChanges { target: tabContainerItem; opacity: 0.0; x: root.width } }, - State { name: "HiddenRight"; PropertyChanges { target: tabContainerItem; opacity: 0.0; x: -root.width } } - ] - - transitions: [ - Transition { - to: "Incoming" - SequentialAnimation { - ScriptAction { script: root.clip = true } - PropertyAnimation { properties: "opacity,x"; easing.type: Easing.InQuad; duration: 250 } - ScriptAction { script: {incomingDone(); root.clip = false} } - } - }, - Transition { - to: "OutgoingLeft,OutgoingRight" - SequentialAnimation { - PropertyAnimation { properties: "opacity,x"; easing.type: Easing.InQuad; duration: 250 } - ScriptAction { script: outgoingDone() } - } - } - ] - } - } - - QtObject { - id: priv - property bool reparenting: false - property bool complete: false - property Item currentTabContainer: root.currentTab ? root.currentTab.parent : null - property int currentIndex: 0 - property Item incomingPage - property Item outgoingPage - property bool animate: true - - onCurrentTabContainerChanged: { - var newCurrentIndex = 0 - for (var i = 0; i < containerHost.children.length; i++) { - if (containerHost.children[i] == currentTabContainer) { - newCurrentIndex = i - break - } - } - - currentTabContainer.visible = true - incomingPage = currentTabContainer.children[0] - incomingPage.visible = true - if (incomingPage.status != undefined) { - incomingPage.status = PageStatus.Activating - } - if (currentIndex < newCurrentIndex) { - currentTabContainer.state = "HiddenLeft" - } else { - currentTabContainer.state = "HiddenRight" - } - if (animate) { - currentTabContainer.state = "Incoming" - } else { - currentTabContainer.incomingDone() - } - - if (newCurrentIndex == currentIndex) { - return - } - - var oldPage = containerHost.children[currentIndex] - outgoingPage = oldPage.children[0] - if (animate) { - if (currentIndex < newCurrentIndex) { - oldPage.state = "OutgoingLeft" - } else { - oldPage.state = "OutgoingRight" - } - } else { - oldPage.outgoingDone() - } - currentIndex = newCurrentIndex - } - } -} diff --git a/plasma/applets/homerun/components/qml/private/IconLoader.qml b/plasma/applets/homerun/components/qml/private/IconLoader.qml deleted file mode 100644 index 422a3843..00000000 --- a/plasma/applets/homerun/components/qml/private/IconLoader.qml +++ /dev/null @@ -1,140 +0,0 @@ -/* -* Copyright (C) 2011 by Marco MArtin -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU Library General Public License as -* published by the Free Software Foundation; either version 2, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU Library General Public License for more details -* -* You should have received a copy of the GNU Library General Public -* License along with this program; if not, write to the -* Free Software Foundation, Inc., -* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -/**Documented API -Inherits: - Item - -Imports: - QtQuick 1.1 - org.kde.plasma.core - org.kde.qtextracomponents - -Description: - TODO i need more info here - -Properties: - bool valid: - Returns if the icon is valid or not. - - string source: - Returns the dir,in which the icon exists. -**/ - -import QtQuick 1.1 -import org.kde.plasma.core 0.1 as PlasmaCore -import org.kde.qtextracomponents 0.1 - -Item { - id: root - - property bool valid: false - - property variant source - - onSourceChanged: { - //is it a qicon? - if (typeof source != "string") { - imageLoader.sourceComponent = iconComponent - valid = true - return - } else if (source == "") { - imageLoader.sourceComponent = null - valid = false - return - } - - svgIcon.imagePath = "toolbar-icons/"+root.source.split("-")[0] - if (!svgIcon.isValid() || !svgIcon.hasElement(root.source)) { - svgIcon.imagePath = "icons/"+root.source.split("-")[0] - } - - if (svgIcon.isValid() && svgIcon.hasElement(root.source)) { - imageLoader.sourceComponent = svgComponent - } else if ((root.source.indexOf(".") == -1 && root.source.indexOf(":") == -1)) { - imageLoader.sourceComponent = iconComponent - } else { - imageLoader.sourceComponent = imageComponent - } - valid = true - } - - implicitWidth: theme.smallIconSize - implicitHeight: theme.smallIconSize - - PlasmaCore.Svg { - id: svgIcon - } - - function roundToStandardSize(size) - { - if (size >= theme.enormousIconSize) { - return theme.enormousIconSize - } else if (size >= theme.hugeIconSize) { - return theme.hugeIconSize - } else if (size >= theme.largeIconSize) { - return theme.largeIconSize - } else if (size >= theme.mediumIconSize) { - return theme.mediumIconSize - } else if (size >= theme.smallMediumIconSize) { - return theme.smallMediumIconSize - } else { - return theme.smallIconSize - } - } - - Loader { - id: imageLoader - anchors.fill: parent - - Component { - id: svgComponent - - PlasmaCore.SvgItem { - svg: svgIcon - elementId: root.source - anchors.fill: parent - smooth: true - } - } - - Component { - id: iconComponent - - QIconItem { - icon: (typeof source == "string") ? QIcon(root.source) : root.source - smooth: true - anchors.fill: parent - } - } - - Component { - id: imageComponent - - Image { - source: root.source - sourceSize.width: width - sourceSize.height: height - fillMode: Image.PreserveAspectFit - smooth: true - anchors.fill: parent - } - } - } -} diff --git a/plasma/applets/homerun/components/qml/private/TabGroup.js b/plasma/applets/homerun/components/qml/private/TabGroup.js deleted file mode 100644 index 52149efd..00000000 --- a/plasma/applets/homerun/components/qml/private/TabGroup.js +++ /dev/null @@ -1,114 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Components project. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ - -var allContainers = [] -var allContents = [] - -function hasContainer(content) { - for (var i = 0; i < allContainers.length; ++i) { - if (allContainers[i].children[0] == content) - return true - } - return false -} - -function addContent(content) { - for (var i = 0; i < allContents.length; ++i) { - if (allContents[i] == content) - return false - } - allContents.push(content) - return true -} - -function ensureContainers() { - var somethingChanged = false - - // check if we need to create a container - for (var i = 0; i < root.privateContents.length; ++i) { - var content = root.privateContents[i] - addContent(content) - if (!hasContainer(content)) { - var newContainer = tabContainerComponent.createObject(containerHost) - content.parent = newContainer - allContainers.push(newContainer) - somethingChanged = true - } - } - return somethingChanged -} - -function addTab(content) { - if (addContent(content)) { - var newContainer = tabContainerComponent.createObject(containerHost) - content.parent = newContainer - allContainers.push(newContainer) - } -} - -function removeTab(content) { - var foundIndex = -1 - for (var i = 0; i < allContents.length && foundIndex == -1; ++i) { - if (allContents[i] == content) - foundIndex = i - } - - if (foundIndex != -1) - allContents.splice(foundIndex, 1) - - if (hasContainer(content)) - content.parent = null // this causes deletion of container -} - -function removeContainer(container) { - var foundIndex = -1 - for (var i = 0; i < allContainers.length && foundIndex == -1; ++i) { - if (allContainers[i] == container) - foundIndex = i - } - - if (foundIndex != -1) { - var deletedContainer = allContainers[foundIndex] - if (deletedContainer.children.length > 0) - removeTab(deletedContainer.children[0]) - allContainers.splice(foundIndex, 1) - deletedContainer.destroy() - } -} diff --git a/plasma/applets/homerun/components/qml/qmldir b/plasma/applets/homerun/components/qml/qmldir deleted file mode 100644 index 232f340a..00000000 --- a/plasma/applets/homerun/components/qml/qmldir +++ /dev/null @@ -1,9 +0,0 @@ -plugin componentsplugin - -ActionMenu 0.1 ActionMenu.qml -DragArea 0.1 DragArea.qml -DragContainer 0.1 DragContainer.qml -TabBar 0.1 TabBar.qml -TabButton 0.1 TabButton.qml -TabGroup 0.1 TabGroup.qml -Label 0.1 Label.qml diff --git a/plasma/applets/homerun/components/shadoweffect.cpp b/plasma/applets/homerun/components/shadoweffect.cpp deleted file mode 100644 index 731c1a8c..00000000 --- a/plasma/applets/homerun/components/shadoweffect.cpp +++ /dev/null @@ -1,240 +0,0 @@ -/* - * Copyright 2013 Aurélien Gâteau - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -// Self -#include - -// Local - -// KDE -#include -#include - -// Qt -#include -#include - -ShadowEffect::ShadowEffect(QObject *parent) -: QGraphicsEffect(parent) -, m_xOffset(0) -, m_yOffset(1) -, m_blurRadius(3) -{ -} - -ShadowEffect::~ShadowEffect() -{ -} - -qreal ShadowEffect::xOffset() const -{ - return m_xOffset; -} - -qreal ShadowEffect::yOffset() const -{ - return m_yOffset; -} - -qreal ShadowEffect::blurRadius() const -{ - return m_blurRadius; -} - -QColor ShadowEffect::color() const -{ - return m_color; -} - -void ShadowEffect::setXOffset(qreal value) -{ - if (qFuzzyCompare(m_xOffset, value)) { - return; - } - m_xOffset = value; - m_shadow = QImage(); - updateBoundingRect(); - xOffsetChanged(m_xOffset); -} - -void ShadowEffect::setYOffset(qreal value) -{ - if (qFuzzyCompare(m_yOffset, value)) { - return; - } - m_yOffset = value; - m_shadow = QImage(); - updateBoundingRect(); - yOffsetChanged(m_yOffset); -} - -void ShadowEffect::setBlurRadius(qreal value) -{ - if (qFuzzyCompare(m_blurRadius, value)) { - return; - } - m_blurRadius = value; - m_shadow = QImage(); - updateBoundingRect(); - blurRadiusChanged(m_blurRadius); -} - -void ShadowEffect::setColor(const QColor &value) -{ - if (m_color == value) { - return; - } - m_color = value; - m_shadow = QImage(); - update(); - colorChanged(m_color); -} - -void ShadowEffect::resetColor() -{ - setColor(QColor()); -} - -QRectF ShadowEffect::boundingRectFor(const QRectF &rect) const -{ - qreal padding = m_blurRadius * 2; - return rect.united( - rect.translated(m_xOffset, m_yOffset) - .adjusted(-padding, -padding, padding, padding) - ); -} - -QImage ShadowEffect::generateShadow(const QPixmap &px) const -{ - if (px.isNull()) { - return QImage(); - } - - QColor color = m_color.isValid() ? m_color : computeColorFromSource(); - - QImage tmp(px.size(), QImage::Format_ARGB32_Premultiplied); - tmp.fill(0); - if (m_blurRadius > 0) { - QPainter painter(&tmp); - painter.setCompositionMode(QPainter::CompositionMode_Source); - painter.drawPixmap(m_xOffset, m_yOffset, px); - painter.end(); - Plasma::PaintUtils::shadowBlur(tmp, m_blurRadius, color); - } else { - QPainter painter(&tmp); - painter.setCompositionMode(QPainter::CompositionMode_Source); - painter.fillRect(m_xOffset, m_yOffset, px.width(), px.height(), color); - painter.setCompositionMode(QPainter::CompositionMode_DestinationIn); - painter.drawPixmap(m_xOffset, m_yOffset, px); - } - return tmp; -} - -void ShadowEffect::draw(QPainter *painter) -{ - if (m_blurRadius < 0 && qFuzzyIsNull(m_xOffset) && qFuzzyIsNull(m_yOffset)) { - drawSource(painter); - return; - } - - PixmapPadMode mode = PadToEffectiveBoundingRect; - if (painter->paintEngine()->type() == QPaintEngine::OpenGL2) { - mode = NoPad; - } - - // Draw pixmap in device coordinates to avoid pixmap scaling. - QPoint offset; - const QPixmap pixmap = sourcePixmap(Qt::DeviceCoordinates, &offset, mode); - if (pixmap.isNull()) { - return; - } - - QTransform restoreTransform = painter->worldTransform(); - painter->setWorldTransform(QTransform()); - if (m_shadow.isNull()) { - m_shadow = generateShadow(pixmap); - } - // Draw shadow (draw it twice to darken it) - painter->drawImage(offset, m_shadow); - painter->drawImage(offset, m_shadow); - // Draw the actual pixmap - painter->drawPixmap(offset, pixmap); - painter->setWorldTransform(restoreTransform); -} - -void ShadowEffect::sourceChanged(ChangeFlags flags) -{ - switch (flags) { - case SourceAttached: - case SourceBoundingRectChanged: - case SourceInvalidated: - m_shadow = QImage(); - break; - case SourceDetached: - break; - } -} - - -/***************************************************************************** - * UGLYNESS - * - * If the shadow color is not defined, we want to compute it from the color of - * the item on which the effect is applied. - * - * To do so we need to reach the item from the effect. - * - * QGraphicsEffect has an internal, but public, "source()" method, which - * returns a pointer to a QGraphicsEffectSource, which has a "graphicsItem()" - * public method. - * - * QGraphicsEffectSource is not in any installed header, so we need to declare - * it. Since "graphicsItem()" is not virtual we can escape with declaring a - * fake QGraphicsEffectSource class, containing only the graphicsItem() method. - * - * The original class is defined in Qt4 in src/gui/effects/qgraphicseffect_p.h - *****************************************************************************/ -class QGraphicsEffectSource -{ -public: - const QGraphicsItem *graphicsItem() const; -}; - - -QColor ShadowEffect::computeColorFromSource() const -{ - const QGraphicsItem *item = source()->graphicsItem(); - if (!item) { - kWarning() << "No source item!"; - return Qt::black; - } - const QGraphicsObject *obj = item->toGraphicsObject(); - if (!obj) { - kWarning() << "Source is not a QGraphicsObject"; - return Qt::black; - } - QVariant variant = obj->property("color"); - if (!variant.canConvert()) { - kWarning() << "Source has no 'color' property, or its 'color' property is not a QColor!"; - return Qt::black; - } - int value = variant.value().value(); - return value >= 128 ? Qt::black : Qt::white; -} - -#include "moc_shadoweffect.cpp" diff --git a/plasma/applets/homerun/components/shadoweffect.h b/plasma/applets/homerun/components/shadoweffect.h deleted file mode 100644 index 6d287c8e..00000000 --- a/plasma/applets/homerun/components/shadoweffect.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright 2013 Aurélien Gâteau - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -#ifndef SHADOWEFFECT_H -#define SHADOWEFFECT_H - -// Qt -#include - -/** - * An effect which draws a shadow behind an item, using - * Plasma::PaintUtils::shadowBlur() - * - * If the color is not specified, it will attempt to compute the best - * appropriate color, based on the item "color" property (if it has any). - */ -class ShadowEffect : public QGraphicsEffect -{ - Q_OBJECT - Q_PROPERTY(qreal xOffset READ xOffset WRITE setXOffset NOTIFY xOffsetChanged) - Q_PROPERTY(qreal yOffset READ yOffset WRITE setYOffset NOTIFY yOffsetChanged) - Q_PROPERTY(qreal blurRadius READ blurRadius WRITE setBlurRadius NOTIFY blurRadiusChanged) - Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) -public: - explicit ShadowEffect(QObject *parent = 0); - ~ShadowEffect(); - - QRectF boundingRectFor(const QRectF &rect) const; // reimp - - qreal xOffset() const; - - qreal yOffset() const; - - qreal blurRadius() const; - QColor color() const; - - /** - * Use this method if you set the color manually and now want ShadowEffect - * to pick the color automatically, based on the color of the item on which - * the effect is applied. - */ - Q_INVOKABLE void resetColor(); - -public Q_SLOTS: - void setXOffset(qreal dx); - void setYOffset(qreal dy); - void setBlurRadius(qreal blurRadius); - void setColor(const QColor &color); - -Q_SIGNALS: - void xOffsetChanged(qreal); - void yOffsetChanged(qreal); - void blurRadiusChanged(qreal blurRadius); - void colorChanged(const QColor &color); - -protected: - void draw(QPainter *painter); // reimp - void sourceChanged(ChangeFlags flags); // reimp - -private: - qreal m_xOffset; - qreal m_yOffset; - qreal m_blurRadius; - QColor m_color; - - QImage m_shadow; - - QImage generateShadow(const QPixmap &px) const; - - QColor computeColorFromSource() const; -}; - -#endif /* SHADOWEFFECT_H */ diff --git a/plasma/applets/homerun/components/sourceconfigurationdialog.cpp b/plasma/applets/homerun/components/sourceconfigurationdialog.cpp deleted file mode 100644 index 063f87ff..00000000 --- a/plasma/applets/homerun/components/sourceconfigurationdialog.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -// Self -#include - -// Local -#include -#include - -// KDE - -// Qt - -namespace Homerun -{ - -SourceConfigurationDialog::SourceConfigurationDialog(AbstractSource *source, const KConfigGroup &group, QWidget *parent) -: KDialog(parent) -, m_sourceWidget(source->createConfigurationWidget(group)) -{ - setMainWidget(m_sourceWidget); -} - -SourceConfigurationDialog::~SourceConfigurationDialog() -{ -} - -void SourceConfigurationDialog::save() -{ - m_sourceWidget->save(); - m_sourceWidget->configGroup().sync(); -} - -} // namespace - -#include "moc_sourceconfigurationdialog.cpp" diff --git a/plasma/applets/homerun/components/sourceconfigurationdialog.h b/plasma/applets/homerun/components/sourceconfigurationdialog.h deleted file mode 100644 index 4784e4e3..00000000 --- a/plasma/applets/homerun/components/sourceconfigurationdialog.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -#ifndef SOURCECONFIGURATIONDIALOG_H -#define SOURCECONFIGURATIONDIALOG_H - -// Local - -// Qt - -// KDE -#include - -class KConfigGroup; - -namespace Homerun -{ - -class AbstractSource; -class SourceConfigurationWidget; - -/** - * A dialog to configure a source - */ -class SourceConfigurationDialog : public KDialog -{ - Q_OBJECT -public: - explicit SourceConfigurationDialog(AbstractSource *source, const KConfigGroup &group, QWidget *parent); - ~SourceConfigurationDialog(); - - Q_INVOKABLE void save(); - -private: - SourceConfigurationWidget *m_sourceWidget; -}; - -} // namespace - -#endif /* SOURCECONFIGURATIONDIALOG_H */ diff --git a/plasma/applets/homerun/components/sourcemodel.cpp b/plasma/applets/homerun/components/sourcemodel.cpp deleted file mode 100644 index 4b40fe51..00000000 --- a/plasma/applets/homerun/components/sourcemodel.cpp +++ /dev/null @@ -1,215 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -// Self -#include - -// Local -#include -#include - -// KDE -#include - -// Qt - -using namespace Homerun; - -static const char *TAB_SOURCES_KEY = "sources"; - -static const char *SOURCE_GROUP_PREFIX = "Source"; -static const char *SOURCE_SOURCEID_KEY = "sourceId"; - -class SourceModelItem -{ -public: - SourceModelItem(AbstractSourceRegistry *registry, const QString &sourceId, const KConfigGroup &group, QObject *parent) - : m_sourceId(sourceId) - , m_group(group) - , m_sourceRegistry(registry) - , m_model(0) - , m_parent(parent) - {} - - QObject *model() const - { - if (!m_model) { - m_model = m_sourceRegistry->createModelFromConfigGroup(m_sourceId, m_group, m_parent); - } - return m_model; - } - - void deleteModel() - { - delete m_model; - m_model = 0; - } - - QString m_sourceId; - KConfigGroup m_group; - -private: - AbstractSourceRegistry *m_sourceRegistry; - mutable QObject *m_model; - QObject *m_parent; -}; - - -SourceModel::SourceModel(AbstractSourceRegistry *registry, const KConfigGroup &tabGroup, QObject *parent) -: QAbstractListModel(parent) -, m_sourceRegistry(registry) -, m_tabGroup(tabGroup) -{ - Q_ASSERT(registry); - QHash roles; - roles.insert(SourceIdRole, "sourceId"); - roles.insert(ModelRole, "model"); - roles.insert(ConfigGroupRole, "configGroup"); - setRoleNames(roles); - reload(); -} - -SourceModel::~SourceModel() -{ - qDeleteAll(m_list); -} - -int SourceModel::rowCount(const QModelIndex &parent) const -{ - if (parent.isValid()) { - return 0; - } - return m_list.count(); -} - -QVariant SourceModel::data(const QModelIndex &index, int role) const -{ - SourceModelItem *item = m_list.value(index.row()); - if (!item) { - kWarning() << "Invalid row" << index.row(); - return QVariant(); - } - - switch (role) { - case SourceIdRole: - return item->m_sourceId; - case ModelRole: - return QVariant::fromValue(item->model()); - case ConfigGroupRole: - return QVariant::fromValue(&item->m_group); - default: - break; - } - return QVariant(); -} - -void SourceModel::reload() -{ - qDeleteAll(m_list); - m_list.clear(); - - QString tabGroupName = m_tabGroup.name(); - - QStringList names = m_tabGroup.readEntry(TAB_SOURCES_KEY, QStringList()); - Q_FOREACH(const QString &name, names) { - KConfigGroup sourceGroup(&m_tabGroup, name); - QString sourceId = sourceGroup.readEntry(SOURCE_SOURCEID_KEY); - SourceModelItem *item = new SourceModelItem(m_sourceRegistry, sourceId, sourceGroup, this); - m_list << item; - } -} - -void SourceModel::appendSource(const QString &sourceId) -{ - KConfigGroup sourceGroup; - for (int idx = 0; ; ++idx) { - sourceGroup = KConfigGroup(&m_tabGroup, SOURCE_GROUP_PREFIX + QString::number(idx)); - if (!sourceGroup.exists()) { - break; - } - } - - beginInsertRows(QModelIndex(), m_list.count(), m_list.count()); - SourceModelItem *item = new SourceModelItem(m_sourceRegistry, sourceId, sourceGroup, this); - m_list << item; - item->m_group.writeEntry(SOURCE_SOURCEID_KEY, sourceId); - item->m_group.sync(); - writeSourcesEntry(); - endInsertRows(); -} - -void SourceModel::writeSourcesEntry() -{ - QStringList lst; - Q_FOREACH(const SourceModelItem *item, m_list) { - lst << item->m_group.name(); - } - m_tabGroup.writeEntry(TAB_SOURCES_KEY, lst); - m_tabGroup.sync(); -} - -void SourceModel::recreateModel(int row) -{ - SourceModelItem *item = m_list.value(row); - if (!item) { - kWarning() << "Invalid row" << row; - return; - } - // Just delete the model: next time the model property is accessed, the - // model will be recreated - item->deleteModel(); - - QModelIndex idx = index(row, 0); - dataChanged(idx, idx); -} - -#define CHECK_ROW(row) \ - if (row < 0 || row >= m_list.count()) { \ - kWarning() << "Invalid row number" << row; \ - return; \ - } - -void SourceModel::remove(int row) -{ - CHECK_ROW(row) - beginRemoveRows(QModelIndex(), row, row); - SourceModelItem *item = m_list.takeAt(row); - item->m_group.deleteGroup(); - delete item; - writeSourcesEntry(); - endRemoveRows(); -} - -void SourceModel::move(int from, int to) -{ - CHECK_ROW(from) - CHECK_ROW(to) - if (from == to) { - kWarning() << "Cannot move row to itself"; - return; - } - // See beginMoveRows() doc for an explanation on modelTo - int modelTo = to + (to > from ? 1 : 0); - beginMoveRows(QModelIndex(), from, from, QModelIndex(), modelTo); - m_list.move(from, to); - writeSourcesEntry(); - endMoveRows(); -} - -#include "moc_sourcemodel.cpp" diff --git a/plasma/applets/homerun/components/sourcemodel.h b/plasma/applets/homerun/components/sourcemodel.h deleted file mode 100644 index 116dc359..00000000 --- a/plasma/applets/homerun/components/sourcemodel.h +++ /dev/null @@ -1,73 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -#ifndef SOURCEMODEL_H -#define SOURCEMODEL_H - -// Local - -// Qt -#include - -// KDE -#include - -namespace Homerun -{ -class AbstractSourceRegistry; -} - -class SourceModelItem; - -/** - * - */ -class SourceModel : public QAbstractListModel -{ - Q_OBJECT - -public: - explicit SourceModel(Homerun::AbstractSourceRegistry *registry, const KConfigGroup &tabGroup, QObject *parent); - ~SourceModel(); - - enum { - SourceIdRole = Qt::UserRole + 1, - ModelRole, - ConfigGroupRole, - }; - - int rowCount(const QModelIndex &parent = QModelIndex()) const; // reimp - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; // reimp - - void reload(); - - Q_INVOKABLE void appendSource(const QString &sourceId); - Q_INVOKABLE void recreateModel(int row); - Q_INVOKABLE void remove(int row); - Q_INVOKABLE void move(int from, int to); - -private: - Homerun::AbstractSourceRegistry *m_sourceRegistry; - KConfigGroup m_tabGroup; - QList m_list; - - void writeSourcesEntry(); -}; - -#endif /* SOURCEMODEL_H */ diff --git a/plasma/applets/homerun/components/sourceregistry.cpp b/plasma/applets/homerun/components/sourceregistry.cpp deleted file mode 100644 index be565e8f..00000000 --- a/plasma/applets/homerun/components/sourceregistry.cpp +++ /dev/null @@ -1,449 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -// Self -#include - -// Local -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// KDE -#include -#include -#include -#include -#include -#include -#include - -// Qt -#include - -namespace Homerun { - -//- SingletonSource ------------------------------------------- -class SingletonSource : public AbstractSource -{ -public: - SingletonSource(QAbstractItemModel *model, SourceRegistry *registry) - : AbstractSource(registry) - , m_model(model) - {} - - QAbstractItemModel *createModelFromConfigGroup(const KConfigGroup &/* group */) - { - return m_model; - } - -private: - QAbstractItemModel *m_model; -}; - -//- SourceInfo ------------------------------------------------ -struct SourceInfo -{ - QString id; - QString visibleName; - QString comment; - AbstractSource *source; - KService::Ptr service; - - SourceInfo() - : source(0) - {} -}; - -//- AvailableSourcesModel ------------------------------------- -class AvailableSourcesModel : public QAbstractListModel -{ -public: - enum { - SourceIdRole = Qt::UserRole + 1, - CommentRole - }; - - AvailableSourcesModel(const QList &sources, QObject *parent) - : QAbstractListModel(parent) - , m_sourceInfos(sources) - { - QHash roles; - roles.insert(Qt::DisplayRole, "display"); - roles.insert(SourceIdRole, "sourceId"); - roles.insert(CommentRole, "comment"); - setRoleNames(roles); - } - - int rowCount(const QModelIndex &parent) const - { - return parent.isValid() ? 0 : m_sourceInfos.size(); - } - - QVariant data(const QModelIndex &index, int role) const - { - int row = index.row(); - if (row < 0 || row >= m_sourceInfos.size()) { - return QVariant(); - } - SourceInfo *sourceInfo = m_sourceInfos.at(row); - switch (role) { - case Qt::DisplayRole: - return sourceInfo->visibleName; - case SourceIdRole: - return sourceInfo->id; - case CommentRole: - return sourceInfo->comment; - default: - break; - } - return QVariant(); - } - -private: - const QList &m_sourceInfos; -}; - -//- SourceRegistryPrivate ------------------------------------- -struct SourceRegistryPrivate -{ - SourceRegistry *q; - QHash m_favoriteModels; - - QList m_sourceInfos; - QHash m_sourceInfoById; - - AvailableSourcesModel *m_availableSourcesModel; - KSharedConfig::Ptr m_config; - - void listSourcePlugins() - { - KService::List offers = KServiceTypeTrader::self()->query( - "Homerun/Source", - QString("[X-KDE-Homerun-APIVersion] == %1").arg(HOMERUN_API_VERSION) - ); - - Q_FOREACH(KService::Ptr ptr, offers) { - KPluginInfo pluginInfo(ptr); - if (pluginInfo.pluginName().isEmpty()) { - kWarning() << "Missing X-KDE-PluginInfo-Name key in" << ptr->entryPath(); - continue; - } - SourceInfo *sourceInfo = new SourceInfo; - sourceInfo->service = ptr; - sourceInfo->id = pluginInfo.pluginName(); - sourceInfo->visibleName = pluginInfo.name(); - sourceInfo->comment = pluginInfo.comment(); - registerSourceInfo(sourceInfo); - } - } - - void loadPluginForSourceInfo(SourceInfo *sourceInfo) - { - Q_ASSERT(sourceInfo->service); - // Create the plugin factory - KPluginLoader loader(*sourceInfo->service); - KPluginFactory *factory = loader.factory(); - if (!factory) { - kWarning() << "Failed to load plugin (desktop file: " << sourceInfo->service->entryPath() << ", source:" << sourceInfo->id << ")"; - kWarning() << loader.errorString(); - return; - } - - // Create the source - AbstractSource *source = factory->create(); - if (!source) { - kWarning() << "Failed to create source from plugin (desktop file: " << sourceInfo->service->entryPath() << ", source:" << sourceInfo->id << ")"; - return; - } - source->setConfig(m_config); - sourceInfo->source = source; - } - - void registerSource(const QString &id, AbstractSource *source, const QString &visibleName, const QString &comment) - { - SourceInfo *info = new SourceInfo; - info->id = id; - info->visibleName = visibleName; - info->source = source; - info->comment = comment; - registerSourceInfo(info); - } - - void registerSourceInfo(SourceInfo *info) - { - m_sourceInfos << info; - m_sourceInfoById.insert(info->id, info); - } - - AbstractSource *sourceById(const QString &id) - { - SourceInfo *sourceInfo = m_sourceInfoById.value(id); - if (!sourceInfo) { - kWarning() << "No source named" << id; - return 0; - } - if (sourceInfo->source) { - return sourceInfo->source; - } - loadPluginForSourceInfo(sourceInfo); - if (!sourceInfo->source) { - kWarning() << "Failed to load source for" << id; - return 0; - } - return sourceInfo->source; - } - - void registerSingleRunnerSources() - { - KPluginInfo::List list = Plasma::PluginLoader::pluginLoader()->listRunnerInfo(); - - Q_FOREACH(const KPluginInfo &info, list) { - if (!info.property("X-Plasma-AdvertiseSingleRunnerQueryMode").toBool()) { - continue; - } - QString runnerId = info.pluginName(); - SingleRunnerSource *source = new SingleRunnerSource(runnerId, q); - QString name = i18n("Runner: %1", info.name()); - registerSource("SingleRunner/" + runnerId, source, name, info.comment()); - } - } -}; - -//- SourceRegistry -------------------------------------------- -SourceRegistry::SourceRegistry(QObject *parent) -: AbstractSourceRegistry(parent) -, d(new SourceRegistryPrivate) -{ - d->q = this; - d->m_availableSourcesModel = new AvailableSourcesModel(d->m_sourceInfos, this); - - d->m_favoriteModels.insert("app", new FavoriteAppsModel(this)); - d->m_favoriteModels.insert("place", new FavoritePlacesModel(this)); - - d->registerSource("InstalledApps", new InstalledAppsSource(this), - i18n("Installed Applications"), - i18n("Browse installed applications by categories") - ); - d->registerSource("GroupedInstalledApps", new GroupedInstalledAppsSource(this), - i18n("All Installed Applications"), - i18n("List all installed applications in a flat list, grouped by categories") - ); - d->registerSource("FilterableInstalledApps", new FilterableInstalledAppsSource(this), - i18n("All Installed Applications With Filters"), - i18n("List all installed applications and filter via the sidebar") - ); - d->registerSource("RecentApps", new RecentAppsSource(this), - i18n("Recent Applications"), - i18n("List the most recently launched applications") - ); - d->registerSource("Dir", new DirSource(this), - i18n("Folder"), - i18n("List the content of a folder and let you browse into sub-folders") - ); - d->registerSource("FavoritePlaces", new SingletonSource(d->m_favoriteModels.value("place"), this), - i18n("Favorite Places"), - i18n("Browse the content of your favorite places") - ); - d->registerSource("FavoriteApps", new SingletonSource(d->m_favoriteModels.value("app"), this), - i18n("Favorite Applications"), - i18n("List applications marked as favorite") - ); - d->registerSource("Power", new SimpleSource(this), - i18n("Power Management"), - i18n("Provide buttons to suspend, hibernate, reboot or halt your computer") - ); - d->registerSource("Session", new SimpleSource(this), - i18n("Session"), - i18n("Provide buttons to lock the screen, log out, or switch to another user") - ); - d->registerSource("OpenedSessions", new SimpleSource(this), - i18n("Opened Sessions"), - i18n("Provide buttons to switch to opened sessions") - ); - d->registerSource("CombinedPowerSession", new CombinedPowerSessionSource(this), - i18n("Power / Session"), - i18n("Provide buttons to manage your workspace session and the power state of your computer") - ); - d->registerSource("Runner", new RunnerSource(this), - i18n("KRunner"), - i18n("Perform searchs using a selection of runners") - ); - - d->registerSingleRunnerSources(); - - d->listSourcePlugins(); -} - -SourceRegistry::~SourceRegistry() -{ - qDeleteAll(d->m_sourceInfos); - delete d; -} - -QObject *SourceRegistry::createModelFromArguments(const QString &sourceId, const QVariantMap &sourceArguments, QObject *parent) -{ - // Get source - AbstractSource *source = d->sourceById(sourceId); - if (!source) { - kWarning() << "Invalid sourceId in group (sourceId=" << sourceId << ")"; - return 0; - } - - // Create model - QAbstractItemModel *model = source->createModelFromArguments(sourceArguments); - if (!model) { - kWarning() << "Failed to create model"; - return 0; - } - model->setObjectName(sourceId); - - // If the model already has a parent, then don't change it. - // This is used by singleton sources to keep their model alive. - if (!model->parent()) { - model->setParent(parent); - } - - return model; -} - -QObject *SourceRegistry::createModelFromConfigGroup(const QString &sourceId, const KConfigGroup &group, QObject *parent) -{ - // Get source - AbstractSource *source = d->sourceById(sourceId); - if (!source) { - kWarning() << "Invalid sourceId in group (sourceId=" << sourceId << ")"; - return 0; - } - - // Create model - QAbstractItemModel *model = source->createModelFromConfigGroup(group); - if (!model) { - kWarning() << "Failed to create model from group" << group.name(); - return 0; - } - model->setObjectName(sourceId); - - // If the model already has a parent, then don't change it. - // This is used by singleton sources to keep their model alive. - if (!model->parent()) { - model->setParent(parent); - } - - return model; -} - -QVariantMap SourceRegistry::favoriteModels() const -{ - QVariantMap map; - auto it = d->m_favoriteModels.constBegin(), end = d->m_favoriteModels.constEnd(); - for (; it != end; ++it) { - map.insert(it.key(), QVariant::fromValue(it.value())); - } - return map; -} - -QAbstractItemModel *SourceRegistry::favoriteModel(const QString &name) const -{ - return d->m_favoriteModels.value(name); -} - -KSharedConfig::Ptr SourceRegistry::config() const -{ - return d->m_config; -} - -QString SourceRegistry::configFileName() const -{ - return d->m_config ? d->m_config->name() : QString(); -} - -void SourceRegistry::setConfigFileName(const QString &name) -{ - if (d->m_config && d->m_config->name() == name) { - return; - } - d->m_config = KSharedConfig::openConfig(name); - Q_FOREACH(SourceInfo *sourceInfo, d->m_sourceInfos) { - AbstractSource *source = sourceInfo->source; - if (source) { - source->setConfig(d->m_config); - } - } - configFileNameChanged(name); -} - -QObject *SourceRegistry::availableSourcesModel() const -{ - return d->m_availableSourcesModel; -} - -QString SourceRegistry::visibleNameForSource(const QString &sourceId) const -{ - SourceInfo *info = d->m_sourceInfoById.value(sourceId); - if (!info) { - kWarning() << "No source for" << sourceId; - return QString(); - } - return info->visibleName; -} - -bool SourceRegistry::isSourceConfigurable(const QString &sourceId) const -{ - AbstractSource *source = d->sourceById(sourceId); - if (!source) { - kWarning() << "No source for" << sourceId; - return false; - } - return source->isConfigurable(); -} - -QObject *SourceRegistry::createConfigurationDialog(const QString &sourceId, const QVariant &configGroupVariant) const -{ - AbstractSource *source = d->sourceById(sourceId); - if (!source) { - kWarning() << "No source for" << sourceId; - return 0; - } - - KConfigGroup *sourceGroup = configGroupVariant.value(); - Q_ASSERT(sourceGroup); - Q_ASSERT(sourceGroup->isValid()); - - return new SourceConfigurationDialog(source, *sourceGroup, QApplication::activeWindow()); -} - -} // namespace Homerun - -#include "moc_sourceregistry.cpp" diff --git a/plasma/applets/homerun/components/sourceregistry.h b/plasma/applets/homerun/components/sourceregistry.h deleted file mode 100644 index d4417fd8..00000000 --- a/plasma/applets/homerun/components/sourceregistry.h +++ /dev/null @@ -1,81 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -#ifndef SOURCEREGISTRY_H -#define SOURCEREGISTRY_H - -// Local -#include - -// Qt - -// KDE -#include - -class QAbstractItemModel; - -namespace Homerun { - -class AbstractSource; -class SourceRegistryPrivate; - -/** - * The source registry. This class is responsible for loading source plugins - * and instantiating source models. - */ -class SourceRegistry : public AbstractSourceRegistry -{ - Q_OBJECT - Q_PROPERTY(QVariantMap favoriteModels READ favoriteModels CONSTANT) - Q_PROPERTY(QString configFileName READ configFileName WRITE setConfigFileName NOTIFY configFileNameChanged) -public: - explicit SourceRegistry(QObject *parent = 0); - ~SourceRegistry(); - - Q_INVOKABLE QObject *createModelFromArguments(const QString &sourceId, const QVariantMap &sourceArguments, QObject *parent); - - QObject *createModelFromConfigGroup(const QString &sourceId, const KConfigGroup &configGroup, QObject *parent); // reimp - KSharedConfig::Ptr config() const; - - QVariantMap favoriteModels() const; - - QAbstractItemModel *favoriteModel(const QString &name) const; - - QString configFileName() const; - void setConfigFileName(const QString &name); - - //// Config API - Q_INVOKABLE QObject *availableSourcesModel() const; - - Q_INVOKABLE QString visibleNameForSource(const QString &sourceId) const; - - Q_INVOKABLE bool isSourceConfigurable(const QString &sourceId) const; - - Q_INVOKABLE QObject *createConfigurationDialog(const QString &sourceId, const QVariant &groupVariant) const; - -Q_SIGNALS: - void configFileNameChanged(const QString &); - -private: - SourceRegistryPrivate * const d; -}; - -} // namespace Homerun - -#endif /* SOURCEREGISTRY_H */ diff --git a/plasma/applets/homerun/components/sources/dir/dirconfigurationwidget.cpp b/plasma/applets/homerun/components/sources/dir/dirconfigurationwidget.cpp deleted file mode 100644 index d2671139..00000000 --- a/plasma/applets/homerun/components/sources/dir/dirconfigurationwidget.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -// Self -#include - -// Local -#include - -// KDE -#include -#include -#include - -// Qt -#include -#include - -using namespace Homerun; - -DirConfigurationWidget::DirConfigurationWidget(const KConfigGroup &group) -: SourceConfigurationWidget(group) -, m_ui(new Ui_DirConfigurationWidget) -{ - m_ui->setupUi(this); - - QFont helpFont = KGlobalSettings::smallestReadableFont(); - m_ui->titleHelpLabel->setFont(helpFont); - - KUrl url = group.readPathEntry("rootUrl", QDir::homePath()); - if (url.isValid()) { - m_ui->urlRequester->setUrl(url); - } - - m_ui->titleLineEdit->setText(group.readEntry("rootName", QString())); -} - -DirConfigurationWidget::~DirConfigurationWidget() -{ - delete m_ui; -} - -void DirConfigurationWidget::save() -{ - KUrl url = m_ui->urlRequester->url().url(); - QString title = m_ui->titleLineEdit->text(); - - configGroup().writePathEntry("rootUrl", url.url()); - configGroup().writeEntry("rootName", title); -} - -#include "moc_dirconfigurationwidget.cpp" diff --git a/plasma/applets/homerun/components/sources/dir/dirconfigurationwidget.h b/plasma/applets/homerun/components/sources/dir/dirconfigurationwidget.h deleted file mode 100644 index 96968e8f..00000000 --- a/plasma/applets/homerun/components/sources/dir/dirconfigurationwidget.h +++ /dev/null @@ -1,48 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -#ifndef DIRCONFIGURATIONWIDGET_H -#define DIRCONFIGURATIONWIDGET_H - -// Local -#include - -// Qt - -// KDE - -class Ui_DirConfigurationWidget; - -/** - * Configuration widget for the Dir source - */ -class DirConfigurationWidget : public Homerun::SourceConfigurationWidget -{ - Q_OBJECT -public: - DirConfigurationWidget(const KConfigGroup &group); - ~DirConfigurationWidget(); - - void save(); // reimp - -private: - Ui_DirConfigurationWidget *m_ui; -}; - -#endif /* DIRCONFIGURATIONWIDGET_H */ diff --git a/plasma/applets/homerun/components/sources/dir/dirconfigurationwidget.ui b/plasma/applets/homerun/components/sources/dir/dirconfigurationwidget.ui deleted file mode 100644 index a85da9b3..00000000 --- a/plasma/applets/homerun/components/sources/dir/dirconfigurationwidget.ui +++ /dev/null @@ -1,83 +0,0 @@ - - - DirConfigurationWidget - - - - 0 - 0 - 400 - 85 - - - - - 0 - 0 - - - - - 400 - 0 - - - - - - - - - - Folder to show: - - - urlRequester - - - - - - - KFile::Directory|KFile::ExistingOnly - - - - - - - - - - Title: - - - titleLineEdit - - - - - - - - 0 - 0 - - - - If title is left empty, the folder name will be used - - - - - - - - KUrlRequester - QFrame -
kurlrequester.h
-
-
- - -
diff --git a/plasma/applets/homerun/components/sources/dir/dirmodel.cpp b/plasma/applets/homerun/components/sources/dir/dirmodel.cpp deleted file mode 100644 index 343bd1bd..00000000 --- a/plasma/applets/homerun/components/sources/dir/dirmodel.cpp +++ /dev/null @@ -1,262 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -// Self -#include - -// Local -#include -#include - -// libhomerun -#include -#include - -// KDE -#include -#include -#include -#include - -// Qt -#include - -namespace Homerun -{ - -static const char *SOURCE_ID = "Dir"; - -static inline KFileItem itemForIndex(const QModelIndex &index) -{ - return index.data(KDirModel::FileItemRole).value(); -} - -//- DirModel ------------------------------------------------------ -QVariantMap DirModel::sourceArguments(const KUrl &rootUrl, const QString &rootName, const KUrl &url) -{ - QVariantMap args; - args.insert("rootUrl", rootUrl.url()); - args.insert("rootName", rootName); - args.insert("url", url.url()); - return args; -} - - -DirModel::DirModel(QObject *parent) -: KDirSortFilterProxyModel(parent) -, m_pathModel(new PathModel(this)) -{ - setSourceModel(new KDirModel(this)); - setSortFoldersFirst(true); - - QHash roles; - roles.insert(Qt::DisplayRole, "display"); - roles.insert(Qt::DecorationRole, "decoration"); - roles.insert(DirModel::FavoriteIdRole, "favoriteId"); - roles.insert(DirModel::HasActionListRole, "hasActionList"); - roles.insert(DirModel::ActionListRole, "actionList"); - setRoleNames(roles); - - dirLister()->setDelayedMimeTypes(true); - connect(dirLister(), SIGNAL(started(KUrl)), SLOT(emitRunningChanged())); - connect(dirLister(), SIGNAL(completed()), SLOT(emitRunningChanged())); -} - -void DirModel::init(const KUrl &rootUrl, const QString &rootName, const KUrl &url) -{ - m_rootUrl = rootUrl; - m_rootName = rootName; - initPathModel(url); - dirLister()->openUrl(url); -} - -void DirModel::initPathModel(const KUrl &openedUrl) -{ - QVariantMap args = sourceArguments(m_rootUrl, m_rootName, m_rootUrl); - m_pathModel->addPath(m_rootName, SOURCE_ID, args); - - KUrl rootUrl = m_rootUrl; - // Needed for KUrl::relativeUrl - rootUrl.adjustPath(KUrl::AddTrailingSlash); - QString relativePath = KUrl::relativeUrl(rootUrl, openedUrl); - if (relativePath == "./") { - return; - } - KUrl url = m_rootUrl; - Q_FOREACH(const QString &token, relativePath.split('/')) { - if (token.isEmpty()) { - // Just in case relativePath ends with '/' - continue; - } - url.addPath(token); - args["url"] = url.url(); - m_pathModel->addPath(token, SOURCE_ID, args); - } -} - -KDirLister *DirModel::dirLister() const -{ - return static_cast(sourceModel())->dirLister(); -} - -QVariant DirModel::data(const QModelIndex &index, int role) const -{ - KFileItem item = qvariant_cast(QSortFilterProxyModel::data(index, KDirModel::FileItemRole)); - - if (role == Qt::DecorationRole && !item.isFinalIconKnown()) { - item.determineMimeType(); - } - - if (role != FavoriteIdRole && role != HasActionListRole && role != ActionListRole) { - return QSortFilterProxyModel::data(index, role); - } - if (index.row() < 0 || index.row() >= rowCount()) { - return QVariant(); - } - if (role == HasActionListRole) { - return true; - } - if (role == FavoriteIdRole) { - if (item.isDir()) { - return FavoriteUtils::favoriteIdFromUrl(item.url()); - } else { - return QString(); - } - } else if (role == ActionListRole) { - return ActionList::createListForFileItem(item); - } - // Never reached - return QVariant(); -} - -int DirModel::count() const -{ - return rowCount(QModelIndex()); -} - -QString DirModel::name() const -{ - return m_rootName; -} - -bool DirModel::running() const -{ - return !dirLister()->isFinished(); -} - -PathModel *DirModel::pathModel() const -{ - return m_pathModel; -} - -QString DirModel::query() const -{ - return filterRegExp().pattern(); -} - -void DirModel::setQuery(const QString &value) -{ - if (value == query()) { - return; - } - setFilterRegExp(QRegExp(value, Qt::CaseInsensitive)); - queryChanged(value); -} - -void DirModel::emitRunningChanged() -{ - runningChanged(running()); -} - -bool DirModel::trigger(int row, const QString &actionId, const QVariant &actionArg) -{ - QModelIndex idx = index(row, 0); - KFileItem item = itemForIndex(idx); - - if (actionId.isEmpty()) { - if (item.isDir()) { - openSourceRequested(SOURCE_ID, sourceArguments(m_rootUrl, m_rootName, item.url())); - } else { - item.run(); - } - } - - bool close; - ActionList::handleFileItemAction(item, actionId, actionArg, &close); - - return false; -} - -//- DirSource ------------------------------------------------------- -DirSource::DirSource(QObject *parent) -: AbstractSource(parent) -{} - -QAbstractItemModel *DirSource::createModelFromArguments(const QVariantMap &args) -{ - KUrl rootUrl = args.value("rootUrl").toString(); - QString rootName = args.value("rootName").toString(); - KUrl url = args.value("url").toString(); - return createModel(rootUrl, rootName, url); -} - -QAbstractItemModel *DirSource::createModelFromConfigGroup(const KConfigGroup &group) -{ - KUrl rootUrl = group.readPathEntry("rootUrl", QDir::homePath()); - QString rootName = group.readEntry("rootName", QString()); - return createModel(rootUrl, rootName, KUrl()); -} - -QAbstractItemModel *DirSource::createModel(const KUrl &rootUrl_, const QString &rootName_, const KUrl &url_) -{ - KUrl rootUrl = rootUrl_; - QString rootName = rootName_; - KUrl url = url_; - if (!rootUrl.isValid()) { - rootUrl = KUrl::fromPath(QDir::homePath()); - } - - if (rootName.isEmpty()) { - rootName = rootUrl.fileName(); - if (rootName.isEmpty()) { - rootName = rootUrl.prettyUrl(); - } - } - if (!url.isValid()) { - url = rootUrl; - } - - DirModel *model = new DirModel; - model->init(rootUrl, rootName, url); - return model; -} - -bool DirSource::isConfigurable() const -{ - return true; -} - -SourceConfigurationWidget *DirSource::createConfigurationWidget(const KConfigGroup &group) -{ - return new DirConfigurationWidget(group); -} - -} // namespace Homerun - -#include "moc_dirmodel.cpp" diff --git a/plasma/applets/homerun/components/sources/dir/dirmodel.h b/plasma/applets/homerun/components/sources/dir/dirmodel.h deleted file mode 100644 index 94355cd1..00000000 --- a/plasma/applets/homerun/components/sources/dir/dirmodel.h +++ /dev/null @@ -1,113 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -#ifndef DIRMODEL_H -#define DIRMODEL_H - -// Local -#include - -// Qt - -// KDE -#include -#include - -class KDirLister; - -namespace Homerun { - -class PathModel; - -/** - * Internal - */ -class DirModel : public KDirSortFilterProxyModel -{ - Q_OBJECT - Q_PROPERTY(int count READ count NOTIFY countChanged) - Q_PROPERTY(QString name READ name CONSTANT) - - Q_PROPERTY(bool running READ running NOTIFY runningChanged) - Q_PROPERTY(QObject *pathModel READ pathModel CONSTANT) - Q_PROPERTY(QString query READ query WRITE setQuery NOTIFY queryChanged) -public: - explicit DirModel(QObject *parent = 0); - - void init(const KUrl &rootUrl, const QString &rootName, const KUrl &url); - - enum { - FavoriteIdRole = Qt::UserRole + 1, - HasActionListRole, - ActionListRole, - }; - - Q_INVOKABLE bool trigger(int row, const QString &actionId = QString(), const QVariant &actionArgument = QVariant()); - - KDirLister *dirLister() const; - - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; // reimp - - PathModel *pathModel() const; - - int count() const; - - QString name() const; - - bool running() const; - - QString query() const; - - void setQuery(const QString &query); - - static QVariantMap sourceArguments(const KUrl &rootUrl, const QString &rootName, const KUrl &url); - -Q_SIGNALS: - void countChanged(); - void runningChanged(bool); - void openSourceRequested(const QString &sourceId, const QVariantMap &sourceArguments); - void queryChanged(const QString &); - -private Q_SLOTS: - void emitRunningChanged(); - -private: - PathModel *m_pathModel; - KUrl m_rootUrl; - QString m_rootName; - - void initPathModel(const KUrl &url); -}; - -class DirSource : public AbstractSource -{ -public: - DirSource(QObject *parent); - QAbstractItemModel *createModelFromConfigGroup(const KConfigGroup &group); - QAbstractItemModel *createModelFromArguments(const QVariantMap &args); - bool isConfigurable() const; - SourceConfigurationWidget *createConfigurationWidget(const KConfigGroup &group); - -private: - QAbstractItemModel *createModel(const KUrl &rootUrl, const QString &rootName, const KUrl &url); -}; - -} // namespace Homerun - -#endif /* DIRMODEL_H */ diff --git a/plasma/applets/homerun/components/sources/favorites/favoriteappsmodel.cpp b/plasma/applets/homerun/components/sources/favorites/favoriteappsmodel.cpp deleted file mode 100644 index 97ccbb61..00000000 --- a/plasma/applets/homerun/components/sources/favorites/favoriteappsmodel.cpp +++ /dev/null @@ -1,354 +0,0 @@ -/* - Copyright 2009 Ivan Cukic - Copyright 2010 Marco Martin - Copyright 2012 Aurélien Gâteau - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -// Own -#include "favoriteappsmodel.h" - -// Qt -#include -#include - -// KDE -#include -#include -#include -#include -#include -#include -#include - -namespace Homerun { - -static QString localXmlFileName() -{ - return KStandardDirs::locateLocal("data", "homerun/favoriteapps.xml"); -} - -static QString systemXmlFileName() -{ - return KStandardDirs::locate("data", "homerun/favoriteapps.xml"); -} - -static QString serviceIdFromFavoriteId(const QString &favoriteId) -{ - if (!favoriteId.startsWith("app:")) { - kWarning() << "Wrong favoriteId" << favoriteId; - return QString(); - } - return favoriteId.mid(4); -} - -FavoriteAppsModel::FavoriteAppsModel(QObject *parent) -: QAbstractListModel(parent) -{ - QHash roles; - roles.insert(Qt::DisplayRole, "display"); - roles.insert(Qt::DecorationRole, "decoration"); - roles.insert(FavoriteIdRole, "favoriteId"); - setRoleNames(roles); - load(); -} - -FavoriteAppsModel::~FavoriteAppsModel() -{ -} - -void FavoriteAppsModel::load() -{ - bool ok; - QString name = localXmlFileName(); - if (QFile::exists(name)) { - ok = loadFromXml(name); - if (ok) { - return; - } else { - kWarning() << "Failed to load from" << name; - } - } - importFromConfigFile(); - if (m_favoriteList.isEmpty()) { - // Nothing to import, load system xml file - ok = loadFromXml(systemXmlFileName()); - if (!ok) { - kWarning() << "Failed to load any favoriteapps file. No apps will be listed as favorite."; - } - } -} - -bool FavoriteAppsModel::loadFromXml(const QString &fileName) -{ - QDomDocument doc; - bool ok; - { - QFile file(fileName); - ok = file.open(QIODevice::ReadOnly); - if (!ok) { - kWarning() << "Failed to open" << fileName << ". Error " << file.error(); - return false; - } - QString msg; - int line, column; - ok = doc.setContent(&file, &msg, &line, &column); - if (!ok) { - kWarning() << "Failed to parse" << fileName << ". Error line" << line << "column" << column << ":" << msg; - return false; - } - } - - beginResetModel(); - m_favoriteList.clear(); - QDomElement root = doc.documentElement(); - for(QDomNode node = root.firstChild(); !node.isNull(); node = node.nextSibling()) { - const QDomElement element = node.toElement(); - if (element.isNull()) { - kWarning() << "Ignoring invalid node"; - continue; - } - const QString serviceId = element.attribute("serviceId"); - if (serviceId.isEmpty()) { - kWarning() << "Ignoring element with empty serviceId attribute"; - continue; - } - KService::Ptr service = KService::serviceByStorageId(serviceId); - if (service.isNull()) { - kWarning() << "Ignoring element with invalid serviceId" << serviceId; - continue; - } - FavoriteInfo info = { service }; - m_favoriteList << info; - } - endResetModel(); - countChanged(); - - return true; -} - -void FavoriteAppsModel::saveToXml() -{ - bool ok; - - QDomDocument doc; - QDomElement root = doc.createElement("apps"); - root.setAttribute("version", "1"); - doc.appendChild(root); - - Q_FOREACH(const FavoriteInfo &info, m_favoriteList) { - QString serviceId = info.service->storageId(); - QDomElement element = doc.createElement("app"); - element.setAttribute("serviceId", serviceId); - root.appendChild(element); - } - - QFile file(localXmlFileName()); - ok = file.open(QIODevice::WriteOnly); - if (!ok) { - kWarning() << "Failed to open" << localXmlFileName() << "for writing. Error" << file.error(); - return; - } - file.write(doc.toByteArray(4)); -} - -void FavoriteAppsModel::addFavorite(const QString &favoriteId) -{ - QString serviceId = serviceIdFromFavoriteId(favoriteId); - if (serviceId.isEmpty()) { - return; - } - KService::Ptr service = KService::serviceByStorageId(serviceId); - if (service.isNull()) { - kWarning() << "Could not find a service for" << serviceId; - return; - } - FavoriteInfo info = { service }; - - int row = m_favoriteList.count(); - beginInsertRows(QModelIndex(), row, row); - m_favoriteList << info; - endInsertRows(); - countChanged(); - - saveToXml(); -} - -void FavoriteAppsModel::removeFavorite(const QString &favoriteId) -{ - int row = rowForFavoriteId(favoriteId); - if (row == -1) { - kWarning() << "Could not find favorite" << favoriteId; - return; - } - beginRemoveRows(QModelIndex(), row, row); - FavoriteInfo info = m_favoriteList.takeAt(row); - endRemoveRows(); - countChanged(); - - saveToXml(); -} - -bool FavoriteAppsModel::isFavorite(const QString &favoriteId) const -{ - return rowForFavoriteId(favoriteId) != -1; -} - -int FavoriteAppsModel::rowForFavoriteId(const QString& favoriteId) const -{ - QString serviceId = serviceIdFromFavoriteId(favoriteId); - if (serviceId.isEmpty()) { - return -1; - } - - for (int row = m_favoriteList.count() - 1; row >= 0; --row) { - const FavoriteInfo& info = m_favoriteList.at(row); - if (info.service->storageId() == serviceId) { - return row; - } - } - return -1; -} - -int FavoriteAppsModel::count() const -{ - return m_favoriteList.count(); -} - -QString FavoriteAppsModel::name() const -{ - return i18n("Favorite Applications"); -} - -QString FavoriteAppsModel::favoritePrefix() const -{ - return "app"; -} - -bool FavoriteAppsModel::canMoveRow() const -{ - return true; -} - -int FavoriteAppsModel::rowCount(const QModelIndex &index) const -{ - if (index.isValid()) { - return 0; - } - return m_favoriteList.count(); -} - -QVariant FavoriteAppsModel::data(const QModelIndex &index, int role) const -{ - KService::Ptr service = m_favoriteList.value(index.row()).service; - if (service.isNull()) { - return QVariant(); - } - if (role == Qt::DisplayRole) { - return service->name(); - } else if (role == Qt::DecorationRole) { - return service->icon(); - } else if (role == FavoriteIdRole) { - return QVariant("app:" + service->storageId()); - } else { - kWarning() << "Unhandled role" << role; - return QVariant(); - } -} - -bool FavoriteAppsModel::trigger(int row) -{ - KService::Ptr service = m_favoriteList.value(row).service; - if (service.isNull()) { - kWarning() << "Invalid row"; - return false; - } - return KRun::run(*service, KUrl::List(), 0); -} - -#define CHECK_ROW(row) \ - if (row < 0 || row >= m_favoriteList.count()) { \ - kWarning() << "Invalid row number" << row; \ - return; \ - } - -void FavoriteAppsModel::moveRow(int from, int to) -{ - CHECK_ROW(from) - CHECK_ROW(to) - if (from == to) { - kWarning() << "Cannot move row to itself"; - return; - } - // See beginMoveRows() doc for an explanation on modelTo - int modelTo = to + (to > from ? 1 : 0); - bool ok = beginMoveRows(QModelIndex(), from, from, QModelIndex(), modelTo); - if (!ok) { - kWarning() << "beginMoveRows failed"; - Q_ASSERT(!"beginMoveRows failed"); - } - m_favoriteList.move(from, to); - endMoveRows(); - - saveToXml(); -} - -void FavoriteAppsModel::importFromConfigFile() -{ - KSharedConfig::Ptr config = KSharedConfig::openConfig("homerunrc", KConfig::SimpleConfig); - KConfigGroup baseGroup(config, "favorites"); - if (!baseGroup.exists()) { - // No favorite to import. Leave now, we do not want to write an empty - // xml file - return; - } - - // Get favorites in a map to order them correctly - QMap favoriteMap; - Q_FOREACH(const QString &favoriteGroup, baseGroup.groupList()) { - if (favoriteGroup.startsWith("favorite-")) { - KConfigGroup favoriteConfig(&baseGroup, favoriteGroup); - int rank = favoriteGroup.split("-").last().toInt(); - QString id = favoriteConfig.readEntry("serviceId"); - KService::Ptr service = KService::serviceByStorageId(id); - if (!service.isNull()) { - favoriteMap.insert(rank, service); - } - } - } - - // Load favorites following map order - beginResetModel(); - auto it = favoriteMap.constBegin(), end = favoriteMap.constEnd(); - for (; it != end; ++it) { - FavoriteInfo info = { it.value() }; - m_favoriteList << info; - } - - // Finish migration - saveToXml(); - config->deleteGroup("favorites"); - config->sync(); - - // Notify outside - endResetModel(); - countChanged(); -} - -} // namespace Homerun - -#include "moc_favoriteappsmodel.cpp" diff --git a/plasma/applets/homerun/components/sources/favorites/favoriteappsmodel.h b/plasma/applets/homerun/components/sources/favorites/favoriteappsmodel.h deleted file mode 100644 index 55821cf0..00000000 --- a/plasma/applets/homerun/components/sources/favorites/favoriteappsmodel.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - Copyright 2009 Ivan Cukic - Copyright 2010 Marco Martin - Copyright 2012 Aurélien Gâteau - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef FAVORITEAPPSMODEL_H -#define FAVORITEAPPSMODEL_H - -#include - -#include -#include - -class QDomDocument; - -namespace Homerun { - -struct FavoriteInfo -{ - KService::Ptr service; -}; - -class FavoriteAppsModel : public QAbstractListModel -{ - Q_OBJECT - Q_PROPERTY(QString name READ name CONSTANT) - Q_PROPERTY(bool canMoveRow READ canMoveRow CONSTANT) - Q_PROPERTY(int count READ count NOTIFY countChanged) - - Q_PROPERTY(QString favoritePrefix READ favoritePrefix CONSTANT) - -public: - FavoriteAppsModel(QObject *parent = 0); - ~FavoriteAppsModel(); - - enum { - FavoriteIdRole = Qt::UserRole + 1 - }; - - int count() const; - QString name() const; - bool canMoveRow() const; - QString favoritePrefix() const; - - int rowCount(const QModelIndex & = QModelIndex()) const; - QVariant data(const QModelIndex &, int role = Qt::DisplayRole) const; - - Q_INVOKABLE bool isFavorite(const QString &favoriteId) const; - Q_INVOKABLE void addFavorite(const QString &favoriteId); - Q_INVOKABLE void removeFavorite(const QString &favoriteId); - - Q_INVOKABLE bool trigger(int row); - - Q_INVOKABLE void moveRow(int from, int to); - -Q_SIGNALS: - void countChanged(); - void itemsMoved(int from, int to, int n); - -private: - KSharedConfig::Ptr m_config; - QList m_favoriteList; - - int rowForFavoriteId(const QString &favoriteId) const; - - void load(); - void importFromConfigFile(); - bool loadFromXml(const QString &fileName); - void saveToXml(); -}; - -} // namespace Homerun - -#endif // FAVORITEAPPSMODEL_H diff --git a/plasma/applets/homerun/components/sources/favorites/favoriteplacesmodel.cpp b/plasma/applets/homerun/components/sources/favorites/favoriteplacesmodel.cpp deleted file mode 100644 index c7bb94e0..00000000 --- a/plasma/applets/homerun/components/sources/favorites/favoriteplacesmodel.cpp +++ /dev/null @@ -1,166 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -#include "favoriteplacesmodel.h" - -// Local -#include -#include - -// libhomerun -#include - -// KDE -#include -#include -#include - -// Qt - -namespace Homerun { - -//- FavoritePlacesModel ------------------------------------------------ -FavoritePlacesModel::FavoritePlacesModel(QObject *parent) -: Fixes::KFilePlacesModel(parent) -{ - QHash roles; - roles.insert(Qt::DisplayRole, "display"); - roles.insert(Qt::DecorationRole, "decoration"); - roles.insert(FavoriteIdRole, "favoriteId"); - roles.insert(HasActionListRole, "hasActionList"); - roles.insert(ActionListRole, "actionList"); - setRoleNames(roles); -} - -QString FavoritePlacesModel::favoritePrefix() const -{ - return "place"; -} - -bool FavoritePlacesModel::isFavorite(const QString &favoriteId) const -{ - return indexForFavoriteId(favoriteId).isValid(); -} - -void FavoritePlacesModel::addFavorite(const QString &favoriteId) -{ - KUrl favoriteUrl = FavoriteUtils::urlFromFavoriteId(favoriteId); - if (favoriteUrl.isEmpty()) { - return; - } - addPlace(favoriteUrl.fileName(), favoriteUrl); -} - -void FavoritePlacesModel::removeFavorite(const QString &favoriteId) -{ - QModelIndex index = indexForFavoriteId(favoriteId); - if (!index.isValid()) { - kWarning() << "No favorite place for" << favoriteId; - return; - } - removePlace(index); -} - -QModelIndex FavoritePlacesModel::indexForFavoriteId(const QString &favoriteId) const -{ - KUrl favoriteUrl = FavoriteUtils::urlFromFavoriteId(favoriteId); - if (favoriteUrl.isEmpty()) { - return QModelIndex(); - } - for (int row = rowCount() - 1; row >= 0; --row) { - QModelIndex idx = index(row, 0); - if (url(idx).equals(favoriteUrl, KUrl::CompareWithoutTrailingSlash)) { - return idx; - } - } - return QModelIndex(); -} - -QVariant FavoritePlacesModel::data(const QModelIndex &index, int role) const -{ - if (role != FavoriteIdRole && role != HasActionListRole && role != ActionListRole) { - return Fixes::KFilePlacesModel::data(index, role); - } - - if (index.row() < 0 || index.row() >= rowCount()) { - return QVariant(); - } - if (role == FavoriteIdRole) { - return QVariant(FavoriteUtils::favoriteIdFromUrl(url(index))); - } - if (role == HasActionListRole) { - return true; - } - if (role == ActionListRole) { - KFileItem item(KFileItem::Unknown, KFileItem::Unknown, url(index)); - return ActionList::createListForFileItem(item); - } - return QVariant(); -} - -bool FavoritePlacesModel::trigger(int row, const QString &actionId, const QVariant &actionArgument) -{ - QModelIndex idx = index(row, 0); - KUrl theUrl = idx.data(Fixes::KFilePlacesModel::UrlRole).value(); - if (actionId.isEmpty()) { - theUrl.adjustPath(KUrl::AddTrailingSlash); - QString rootName = idx.data(Qt::DisplayRole).toString(); - openSourceRequested("Dir", DirModel::sourceArguments(theUrl, rootName, theUrl)); - return false; - } - - bool close; - KFileItem item(KFileItem::Unknown, KFileItem::Unknown, theUrl); - if (ActionList::handleFileItemAction(item, actionId, actionArgument, &close)) { - return close; - } - - return false; -} - -QString FavoritePlacesModel::name() const -{ - return i18n("Favorite Places"); -} - -int FavoritePlacesModel::count() const -{ - return rowCount(QModelIndex()); -} - -void FavoritePlacesModel::moveRow(int from, int to) -{ - // Simulate a move by drag'n'drop because moving the row this way - // is the only way to get rowsMoved() signals instead of remove+insert - QMimeData *data = mimeData(QModelIndexList() << index(from, 0)); - Q_ASSERT(data); - if (from < to) { - ++to; - } - dropMimeData(data, Qt::MoveAction, to, 0, QModelIndex()); -} - -bool FavoritePlacesModel::canMoveRow() const -{ - return true; -} - -} // namespace Homerun - -#include "moc_favoriteplacesmodel.cpp" diff --git a/plasma/applets/homerun/components/sources/favorites/favoriteplacesmodel.h b/plasma/applets/homerun/components/sources/favorites/favoriteplacesmodel.h deleted file mode 100644 index 22149366..00000000 --- a/plasma/applets/homerun/components/sources/favorites/favoriteplacesmodel.h +++ /dev/null @@ -1,78 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -#ifndef PLACESMODEL_H -#define PLACESMODEL_H - -// Local -#include - -// Qt - -// KDE - -namespace Homerun { - -/** - * Adapts KFilePlacesModel to make it usable as a Homerun favorite model - */ -class FavoritePlacesModel : public Fixes::KFilePlacesModel -{ - Q_OBJECT - Q_PROPERTY(QString favoritePrefix READ favoritePrefix CONSTANT) - Q_PROPERTY(int count READ count NOTIFY countChanged) - Q_PROPERTY(QString name READ name CONSTANT) - Q_PROPERTY(bool canMoveRow READ canMoveRow CONSTANT) - -public: - enum { - FavoriteIdRole = Qt::UserRole + 1, - HasActionListRole, - ActionListRole, - }; - - FavoritePlacesModel(QObject *parent = 0); - - Q_INVOKABLE bool isFavorite(const QString &favoriteId) const; - Q_INVOKABLE void addFavorite(const QString &favoriteId); - Q_INVOKABLE void removeFavorite(const QString &favoriteId); - Q_INVOKABLE bool trigger(int row, const QString &actionId, const QVariant &actionArg); - Q_INVOKABLE void moveRow(int from, int to); - - QString favoritePrefix() const; - - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; // reimp - - QString name() const; - - int count() const; - - bool canMoveRow() const; - -Q_SIGNALS: - void openSourceRequested(const QString &sourceId, const QVariantMap &sourceArguments); - void countChanged(); - -private: - QModelIndex indexForFavoriteId(const QString &favoriteId) const; -}; - -} // namespace Homerun - -#endif /* PLACESMODEL_H */ diff --git a/plasma/applets/homerun/components/sources/favorites/favoriteutils.cpp b/plasma/applets/homerun/components/sources/favorites/favoriteutils.cpp deleted file mode 100644 index b70c75e1..00000000 --- a/plasma/applets/homerun/components/sources/favorites/favoriteutils.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* -Copyright 2013 Aurélien Gâteau - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -#include - -// KDE -#include -#include - -namespace Homerun -{ - -namespace FavoriteUtils -{ - -KUrl urlFromFavoriteId(const QString &favoriteId) -{ - if (!favoriteId.startsWith("place:")) { - kWarning() << "Wrong favoriteId" << favoriteId; - return QString(); - } - return KUrl(favoriteId.mid(6)); -} - -QString favoriteIdFromUrl(const KUrl &url) -{ - return "place:" + url.url(); -} - -} // namespace FavoriteUtils - -} // namespace Homerun diff --git a/plasma/applets/homerun/components/sources/favorites/favoriteutils.h b/plasma/applets/homerun/components/sources/favorites/favoriteutils.h deleted file mode 100644 index a9711c7a..00000000 --- a/plasma/applets/homerun/components/sources/favorites/favoriteutils.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -Copyright 2013 Aurélien Gâteau - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -#ifndef FAVORITEUTILS_H -#define FAVORITEUTILS_H - -class QString; -class KUrl; - -namespace Homerun -{ - -namespace FavoriteUtils -{ - -KUrl urlFromFavoriteId(const QString &favoriteId); -QString favoriteIdFromUrl(const KUrl &url); - -} // namespace FavoriteUtils - -} // namespace Homerun - -#endif /* FAVORITEUTILS_H */ diff --git a/plasma/applets/homerun/components/sources/favorites/fileplacesmodel.cpp b/plasma/applets/homerun/components/sources/favorites/fileplacesmodel.cpp deleted file mode 100644 index dce4cd6c..00000000 --- a/plasma/applets/homerun/components/sources/favorites/fileplacesmodel.cpp +++ /dev/null @@ -1,876 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2007 Kevin Ottens - Copyright (C) 2007 David Faure - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License version 2 as published by the Free Software Foundation. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - -*/ -#include "fileplacesmodel.h" -#include "kfileplacesitem_p.h" -#include "kfileplacessharedbookmarks_p.h" - -#ifdef _WIN32_WCE -#include "Windows.h" -#include "WinBase.h" -#include -#endif - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -namespace Homerun -{ -namespace Fixes -{ - -class KFilePlacesModel::Private -{ -public: - Private(KFilePlacesModel *self) : q(self), bookmarkManager(0), sharedBookmarks(0) {} - ~Private() - { - delete sharedBookmarks; - qDeleteAll(items); - } - - KFilePlacesModel *q; - - QList items; - QSet availableDevices; - QMap setupInProgress; - - Solid::Predicate predicate; - KBookmarkManager *bookmarkManager; - KFilePlacesSharedBookmarks * sharedBookmarks; - - void reloadAndSignal(); - QList loadBookmarkList(); - - void _k_initDeviceList(); - void _k_deviceAdded(const QString &udi); - void _k_deviceRemoved(const QString &udi); - void _k_itemChanged(const QString &udi); - void _k_reloadBookmarks(); - void _k_storageSetupDone(Solid::ErrorType error, QVariant errorData); - void _k_storageTeardownDone(Solid::ErrorType error, QVariant errorData); -}; - -KFilePlacesModel::KFilePlacesModel(QObject *parent) - : QAbstractItemModel(parent), d(new Private(this)) -{ - const QString file = KStandardDirs::locateLocal("data", "kfileplaces/bookmarks.xml"); - d->bookmarkManager = KBookmarkManager::managerForFile(file, "kfilePlaces"); - - // Let's put some places in there if it's empty. We have a corner case here: - // Given you have bookmarked some folders (which have been saved on - // ~/.local/share/user-places.xbel (according to freedesktop bookmarks spec), and - // deleted the home directory ~/.kde, the call managerForFile() will return the - // bookmark manager for the fallback "kfilePlaces", making root.first().isNull() being - // false (you have your own items bookmarked), resulting on only being added your own - // bookmarks, and not the default ones too. So, we also check if kfileplaces/bookmarks.xml - // file exists, and if it doesn't, we also add the default places. (ereslibre) - KBookmarkGroup root = d->bookmarkManager->root(); - if (root.first().isNull() || !QFile::exists(file)) { - - // NOTE: The context for these I18N_NOOP2 calls has to be "KFile System Bookmarks". - // The real i18nc call is made later, with this context, so the two must match. - // - // createSystemBookmark actually does nothing with its third argument, - // but we have to give it something so the I18N_NOOP2 calls stay here for now. - // - // (coles, 13th May 2009) - - KFilePlacesItem::createSystemBookmark(d->bookmarkManager, - "Home", I18N_NOOP2("KFile System Bookmarks", "Home"), - KUrl(KUser().homeDir()), "user-home"); - KFilePlacesItem::createSystemBookmark(d->bookmarkManager, - "Network", I18N_NOOP2("KFile System Bookmarks", "Network"), - KUrl("remote:/"), "network-workgroup"); -#if defined(_WIN32_WCE) - // adding drives - foreach ( const QFileInfo& info, QDir::drives() ) { - QString driveIcon = "drive-harddisk"; - KFilePlacesItem::createSystemBookmark(d->bookmarkManager, - info.absoluteFilePath(), info.absoluteFilePath(), - KUrl(info.absoluteFilePath()), driveIcon); - } -#elif !defined(Q_OS_WIN) - KFilePlacesItem::createSystemBookmark(d->bookmarkManager, - "Root", I18N_NOOP2("KFile System Bookmarks", "Root"), - KUrl("/"), "folder-red"); -#endif - KFilePlacesItem::createSystemBookmark(d->bookmarkManager, - "Trash", I18N_NOOP2("KFile System Bookmarks", "Trash"), - KUrl("trash:/"), "user-trash"); - - // Force bookmarks to be saved. If on open/save dialog and the bookmarks are not saved, QFile::exists - // will always return false, which opening/closing all the time the open/save dialog would case the - // bookmarks to be added once each time, having lots of times each bookmark. This forces the defaults - // to be saved on the bookmarks.xml file. Of course, the complete list of bookmarks (those that come from - // user-places.xbel will be filled later). (ereslibre) - d->bookmarkManager->saveAs(file); - } - - // create after, so if we have own places, they are added afterwards, in case of equal priorities - d->sharedBookmarks = new KFilePlacesSharedBookmarks(d->bookmarkManager); - - QString predicate("[[[[ StorageVolume.ignored == false AND [ StorageVolume.usage == 'FileSystem' OR StorageVolume.usage == 'Encrypted' ]]" - " OR " - "[ IS StorageAccess AND StorageDrive.driveType == 'Floppy' ]]" - " OR " - "OpticalDisc.availableContent & 'Audio' ]" - " OR " - "StorageAccess.ignored == false ]"); - - if (KProtocolInfo::isKnownProtocol("mtp")) { - predicate.prepend("["); - predicate.append(" OR PortableMediaPlayer.supportedProtocols == 'mtp']"); - } - - d->predicate = Solid::Predicate::fromString(predicate); - - Q_ASSERT(d->predicate.isValid()); - - connect(d->bookmarkManager, SIGNAL(changed(QString,QString)), - this, SLOT(_k_reloadBookmarks())); - connect(d->bookmarkManager, SIGNAL(bookmarksChanged(QString)), - this, SLOT(_k_reloadBookmarks())); - - d->_k_reloadBookmarks(); - QTimer::singleShot(0, this, SLOT(_k_initDeviceList())); -} - -KFilePlacesModel::~KFilePlacesModel() -{ - delete d; -} - -KUrl KFilePlacesModel::url(const QModelIndex &index) const -{ - return KUrl(data(index, UrlRole).toUrl()); -} - -bool KFilePlacesModel::setupNeeded(const QModelIndex &index) const -{ - return data(index, SetupNeededRole).toBool(); -} - -KIcon KFilePlacesModel::icon(const QModelIndex &index) const -{ - return KIcon(data(index, Qt::DecorationRole).value()); -} - -QString KFilePlacesModel::text(const QModelIndex &index) const -{ - return data(index, Qt::DisplayRole).toString(); -} - -bool KFilePlacesModel::isHidden(const QModelIndex &index) const -{ - return data(index, HiddenRole).toBool(); -} - -bool KFilePlacesModel::isDevice(const QModelIndex &index) const -{ - if (!index.isValid()) - return false; - - KFilePlacesItem *item = static_cast(index.internalPointer()); - - return item->isDevice(); -} - -Solid::Device KFilePlacesModel::deviceForIndex(const QModelIndex &index) const -{ - if (!index.isValid()) - return Solid::Device(); - - KFilePlacesItem *item = static_cast(index.internalPointer()); - - if (item->isDevice()) { - return item->device(); - } else { - return Solid::Device(); - } -} - -KBookmark KFilePlacesModel::bookmarkForIndex(const QModelIndex &index) const -{ - if (!index.isValid()) - return KBookmark(); - - KFilePlacesItem *item = static_cast(index.internalPointer()); - - if (!item->isDevice()) { - return item->bookmark(); - } else { - return KBookmark(); - } -} - -QVariant KFilePlacesModel::data(const QModelIndex &index, int role) const -{ - if (!index.isValid()) - return QVariant(); - - KFilePlacesItem *item = static_cast(index.internalPointer()); - return item->data(role); -} - -QModelIndex KFilePlacesModel::index(int row, int column, const QModelIndex &parent) const -{ - if (row<0 || column!=0 || row>=d->items.size()) - return QModelIndex(); - - if (parent.isValid()) - return QModelIndex(); - - return createIndex(row, column, d->items.at(row)); -} - -QModelIndex KFilePlacesModel::parent(const QModelIndex &child) const -{ - Q_UNUSED(child); - return QModelIndex(); -} - -int KFilePlacesModel::rowCount(const QModelIndex &parent) const -{ - if (parent.isValid()) - return 0; - else - return d->items.size(); -} - -int KFilePlacesModel::columnCount(const QModelIndex &parent) const -{ - Q_UNUSED(parent) - // We only know 1 piece of information for a particular entry - return 1; -} - -QModelIndex KFilePlacesModel::closestItem(const KUrl &url) const -{ - int foundRow = -1; - int maxLength = 0; - - // Search the item which is equal to the URL or at least is a parent URL. - // If there are more than one possible item URL candidates, choose the item - // which covers the bigger range of the URL. - for (int row = 0; rowitems.size(); ++row) { - KFilePlacesItem *item = d->items[row]; - KUrl itemUrl = KUrl(item->data(UrlRole).toUrl()); - - if (itemUrl.isParentOf(url)) { - const int length = itemUrl.prettyUrl().length(); - if (length > maxLength) { - foundRow = row; - maxLength = length; - } - } - } - - if (foundRow==-1) - return QModelIndex(); - else - return createIndex(foundRow, 0, d->items[foundRow]); -} - -void KFilePlacesModel::Private::_k_initDeviceList() -{ - Solid::DeviceNotifier *notifier = Solid::DeviceNotifier::instance(); - - connect(notifier, SIGNAL(deviceAdded(QString)), - q, SLOT(_k_deviceAdded(QString))); - connect(notifier, SIGNAL(deviceRemoved(QString)), - q, SLOT(_k_deviceRemoved(QString))); - - const QList &deviceList = Solid::Device::listFromQuery(predicate); - - foreach(const Solid::Device &device, deviceList) { - availableDevices << device.udi(); - } - - _k_reloadBookmarks(); -} - -void KFilePlacesModel::Private::_k_deviceAdded(const QString &udi) -{ - Solid::Device d(udi); - - if (predicate.matches(d)) { - availableDevices << udi; - _k_reloadBookmarks(); - } -} - -void KFilePlacesModel::Private::_k_deviceRemoved(const QString &udi) -{ - if (availableDevices.contains(udi)) { - availableDevices.remove(udi); - _k_reloadBookmarks(); - } -} - -void KFilePlacesModel::Private::_k_itemChanged(const QString &id) -{ - for (int row = 0; rowid()==id) { - QModelIndex index = q->index(row, 0); - emit q->dataChanged(index, index); - } - } -} - -void KFilePlacesModel::Private::_k_reloadBookmarks() -{ - QList currentItems = loadBookmarkList(); - - QList::Iterator it_i = items.begin(); - QList::Iterator it_c = currentItems.begin(); - - QList::Iterator end_i = items.end(); - QList::Iterator end_c = currentItems.end(); - - while (it_i!=end_i || it_c!=end_c) { - if (it_i==end_i && it_c!=end_c) { - int row = items.count(); - - q->beginInsertRows(QModelIndex(), row, row); - it_i = items.insert(it_i, *it_c); - ++it_i; - it_c = currentItems.erase(it_c); - - end_i = items.end(); - end_c = currentItems.end(); - q->endInsertRows(); - - } else if (it_i!=end_i && it_c==end_c) { - int row = items.indexOf(*it_i); - - q->beginRemoveRows(QModelIndex(), row, row); - delete *it_i; - it_i = items.erase(it_i); - - end_i = items.end(); - end_c = currentItems.end(); - q->endRemoveRows(); - - } else if ((*it_i)->id()==(*it_c)->id()) { - bool shouldEmit = !((*it_i)->bookmark()==(*it_c)->bookmark()); - (*it_i)->setBookmark((*it_c)->bookmark()); - if (shouldEmit) { - int row = items.indexOf(*it_i); - QModelIndex idx = q->index(row, 0); - emit q->dataChanged(idx, idx); - } - ++it_i; - ++it_c; - } else if ((*it_i)->id()!=(*it_c)->id()) { - int row = items.indexOf(*it_i); - - if (it_i+1!=end_i && (*(it_i+1))->id()==(*it_c)->id()) { // if the next one matches, it's a remove - q->beginRemoveRows(QModelIndex(), row, row); - delete *it_i; - it_i = items.erase(it_i); - - end_i = items.end(); - end_c = currentItems.end(); - q->endRemoveRows(); - } else { - q->beginInsertRows(QModelIndex(), row, row); - it_i = items.insert(it_i, *it_c); - ++it_i; - it_c = currentItems.erase(it_c); - - end_i = items.end(); - end_c = currentItems.end(); - q->endInsertRows(); - } - } - } - - qDeleteAll(currentItems); - currentItems.clear(); -} - -QList KFilePlacesModel::Private::loadBookmarkList() -{ - QList items; - - KBookmarkGroup root = bookmarkManager->root(); - KBookmark bookmark = root.first(); - QSet devices = availableDevices; - - while (!bookmark.isNull()) { - QString udi = bookmark.metaDataItem("UDI"); - QString appName = bookmark.metaDataItem("OnlyInApp"); - bool deviceAvailable = devices.remove(udi); - - bool allowedHere = appName.isEmpty() || (appName==KGlobal::mainComponent().componentName()); - - if ((udi.isEmpty() && allowedHere) || deviceAvailable) { - KFilePlacesItem *item; - if (deviceAvailable) { - item = new KFilePlacesItem(bookmarkManager, bookmark.address(), udi); - // TODO: Update bookmark internal element - } else { - item = new KFilePlacesItem(bookmarkManager, bookmark.address()); - } - connect(item, SIGNAL(itemChanged(QString)), - q, SLOT(_k_itemChanged(QString))); - items << item; - } - - bookmark = root.next(bookmark); - } - - // Add bookmarks for the remaining devices, they were previously unknown - foreach (const QString &udi, devices) { - bookmark = KFilePlacesItem::createDeviceBookmark(bookmarkManager, udi); - if (!bookmark.isNull()) { - KFilePlacesItem *item = new KFilePlacesItem(bookmarkManager, - bookmark.address(), udi); - connect(item, SIGNAL(itemChanged(QString)), - q, SLOT(_k_itemChanged(QString))); - // TODO: Update bookmark internal element - items << item; - } - } - - return items; -} - -void KFilePlacesModel::Private::reloadAndSignal() -{ - bookmarkManager->emitChanged(bookmarkManager->root()); // ... we'll get relisted anyway -} - -Qt::DropActions KFilePlacesModel::supportedDropActions() const -{ - return Qt::ActionMask; -} - -Qt::ItemFlags KFilePlacesModel::flags(const QModelIndex &index) const -{ - Qt::ItemFlags res = Qt::ItemIsSelectable|Qt::ItemIsEnabled; - - if (index.isValid()) - res|= Qt::ItemIsDragEnabled; - - if (!index.isValid()) - res|= Qt::ItemIsDropEnabled; - - return res; -} - -static QString _k_internalMimetype(const KFilePlacesModel * const self) -{ - return QString("application/x-fileplacesmodel-")+QString::number((qptrdiff)self); -} - -QStringList KFilePlacesModel::mimeTypes() const -{ - QStringList types; - - types << _k_internalMimetype(this) << "text/uri-list"; - - return types; -} - -QMimeData *KFilePlacesModel::mimeData(const QModelIndexList &indexes) const -{ - KUrl::List urls; - QByteArray itemData; - - QDataStream stream(&itemData, QIODevice::WriteOnly); - - foreach (const QModelIndex &index, indexes) { - KUrl itemUrl = url(index); - if (itemUrl.isValid()) - urls << itemUrl; - stream << index.row(); - } - - QMimeData *mimeData = new QMimeData(); - - if (!urls.isEmpty()) - urls.populateMimeData(mimeData); - - mimeData->setData(_k_internalMimetype(this), itemData); - - return mimeData; -} - -bool KFilePlacesModel::dropMimeData(const QMimeData *data, Qt::DropAction action, - int row, int column, const QModelIndex &parent) -{ - if (action == Qt::IgnoreAction) - return true; - - if (column > 0) - return false; - - if (row==-1 && parent.isValid()) { - return false; // Don't allow to move an item onto another one, - // too easy for the user to mess something up - // If we really really want to allow copying files this way, - // let's do it in the views to get the good old drop menu - } - - - KBookmark afterBookmark; - - if (row==-1) { - // The dropped item is moved or added to the last position - - KFilePlacesItem *lastItem = d->items.last(); - afterBookmark = lastItem->bookmark(); - - } else { - // The dropped item is moved or added before position 'row', ie after position 'row-1' - - if (row>0) { - KFilePlacesItem *afterItem = d->items[row-1]; - afterBookmark = afterItem->bookmark(); - } - } - - if (data->hasFormat(_k_internalMimetype(this))) { - // The operation is an internal move - QByteArray itemData = data->data(_k_internalMimetype(this)); - QDataStream stream(&itemData, QIODevice::ReadOnly); - int itemRow; - - stream >> itemRow; - - KFilePlacesItem *item = d->items[itemRow]; - KBookmark bookmark = item->bookmark(); - - int destRow = row == -1 ? d->items.count() : row; - beginMoveRows(QModelIndex(), itemRow, itemRow, QModelIndex(), destRow); - d->bookmarkManager->root().moveBookmark(bookmark, afterBookmark); - // Move item ourselves so that _k_reloadBookmarks() does not consider - // the move as a remove + insert. - // - // 2nd argument of QList::move() expects the final destination index, - // but 'row' is the value of the destination index before the moved - // item has been removed from its original position. That is why we - // adjust if necessary. - d->items.move(itemRow, itemRow < destRow ? (destRow - 1) : destRow); - endMoveRows(); - } else if (data->hasFormat("text/uri-list")) { - // The operation is an add - KUrl::List urls = KUrl::List::fromMimeData(data); - - KBookmarkGroup group = d->bookmarkManager->root(); - - foreach (const KUrl &url, urls) { - // TODO: use KIO::stat in order to get the UDS_DISPLAY_NAME too - KMimeType::Ptr mimetype = KMimeType::mimeType(KIO::NetAccess::mimetype(url, 0)); - - if (!mimetype) { - kWarning() << "URL not added to Places as mimetype could not be determined!"; - continue; - } - - if (!mimetype->is("inode/directory")) { - // Only directories are allowed - continue; - } - - KBookmark bookmark = KFilePlacesItem::createBookmark(d->bookmarkManager, - url.fileName(), url, - mimetype->iconName(url)); - group.moveBookmark(bookmark, afterBookmark); - afterBookmark = bookmark; - } - - } else { - // Oops, shouldn't happen thanks to mimeTypes() - kWarning() << ": received wrong mimedata, " << data->formats(); - return false; - } - - d->reloadAndSignal(); - - return true; -} - -void KFilePlacesModel::addPlace(const QString &text, const KUrl &url, - const QString &iconName, const QString &appName) -{ - addPlace(text, url, iconName, appName, QModelIndex()); -} - -void KFilePlacesModel::addPlace(const QString &text, const KUrl &url, - const QString &iconName, const QString &appName, - const QModelIndex &after) -{ - KBookmark bookmark = KFilePlacesItem::createBookmark(d->bookmarkManager, - text, url, iconName); - - if (!appName.isEmpty()) { - bookmark.setMetaDataItem("OnlyInApp", appName); - } - - if (after.isValid()) { - KFilePlacesItem *item = static_cast(after.internalPointer()); - d->bookmarkManager->root().moveBookmark(bookmark, item->bookmark()); - } - - d->reloadAndSignal(); -} - -void KFilePlacesModel::editPlace(const QModelIndex &index, const QString &text, const KUrl &url, - const QString &iconName, const QString &appName) -{ - if (!index.isValid()) return; - - KFilePlacesItem *item = static_cast(index.internalPointer()); - - if (item->isDevice()) return; - - KBookmark bookmark = item->bookmark(); - - if (bookmark.isNull()) return; - - bookmark.setFullText(text); - bookmark.setUrl(url); - bookmark.setIcon(iconName); - bookmark.setMetaDataItem("OnlyInApp", appName); - - d->reloadAndSignal(); - emit dataChanged(index, index); -} - -void KFilePlacesModel::removePlace(const QModelIndex &index) const -{ - if (!index.isValid()) return; - - KFilePlacesItem *item = static_cast(index.internalPointer()); - - if (item->isDevice()) return; - - KBookmark bookmark = item->bookmark(); - - if (bookmark.isNull()) return; - - d->bookmarkManager->root().deleteBookmark(bookmark); - d->reloadAndSignal(); -} - -void KFilePlacesModel::setPlaceHidden(const QModelIndex &index, bool hidden) -{ - if (!index.isValid()) return; - - KFilePlacesItem *item = static_cast(index.internalPointer()); - - KBookmark bookmark = item->bookmark(); - - if (bookmark.isNull()) return; - - bookmark.setMetaDataItem("IsHidden", (hidden ? "true" : "false")); - - d->reloadAndSignal(); - emit dataChanged(index, index); -} - -int KFilePlacesModel::hiddenCount() const -{ - int rows = rowCount(); - int hidden = 0; - - for (int i=0; i() && device.as()->isAccessible()) { - - Solid::StorageDrive *drive = device.as(); - - if (drive==0) { - drive = device.parent().as(); - } - - bool hotpluggable = false; - bool removable = false; - - if (drive!=0) { - hotpluggable = drive->isHotpluggable(); - removable = drive->isRemovable(); - } - - QString iconName; - QString text; - QString label = data(index, Qt::DisplayRole).toString().replace('&',"&&"); - - if (device.is()) { - text = i18n("&Release '%1'", label); - } else if (removable || hotpluggable) { - text = i18n("&Safely Remove '%1'", label); - iconName = "media-eject"; - } else { - text = i18n("&Unmount '%1'", label); - iconName = "media-eject"; - } - - if (!iconName.isEmpty()) { - return new QAction(KIcon(iconName), text, 0); - } else { - return new QAction(text, 0); - } - } - - return 0; -} - -QAction *KFilePlacesModel::ejectActionForIndex(const QModelIndex &index) const -{ - Solid::Device device = deviceForIndex(index); - - if (device.is()) { - - QString label = data(index, Qt::DisplayRole).toString().replace('&',"&&"); - QString text = i18n("&Eject '%1'", label); - - return new QAction(KIcon("media-eject"), text, 0); - } - - return 0; -} - -void KFilePlacesModel::requestTeardown(const QModelIndex &index) -{ - Solid::Device device = deviceForIndex(index); - Solid::StorageAccess *access = device.as(); - - if (access!=0) { - connect(access, SIGNAL(teardownDone(Solid::ErrorType,QVariant,QString)), - this, SLOT(_k_storageTeardownDone(Solid::ErrorType,QVariant))); - - access->teardown(); - } -} - -void KFilePlacesModel::requestEject(const QModelIndex &index) -{ - Solid::Device device = deviceForIndex(index); - - Solid::OpticalDrive *drive = device.parent().as(); - - if (drive!=0) { - connect(drive, SIGNAL(ejectDone(Solid::ErrorType,QVariant,QString)), - this, SLOT(_k_storageTeardownDone(Solid::ErrorType,QVariant))); - - drive->eject(); - } else { - QString label = data(index, Qt::DisplayRole).toString().replace('&',"&&"); - QString message = i18n("The device '%1' is not a disk and cannot be ejected.", label); - emit errorMessage(message); - } -} - -void KFilePlacesModel::requestSetup(const QModelIndex &index) -{ - Solid::Device device = deviceForIndex(index); - - if (device.is() - && !d->setupInProgress.contains(device.as()) - && !device.as()->isAccessible()) { - - Solid::StorageAccess *access = device.as(); - - d->setupInProgress[access] = index; - - connect(access, SIGNAL(setupDone(Solid::ErrorType,QVariant,QString)), - this, SLOT(_k_storageSetupDone(Solid::ErrorType,QVariant))); - - access->setup(); - } -} - -void KFilePlacesModel::Private::_k_storageSetupDone(Solid::ErrorType error, QVariant errorData) -{ - QPersistentModelIndex index = setupInProgress.take(q->sender()); - - if (!index.isValid()) { - return; - } - - if (!error) { - emit q->setupDone(index, true); - } else { - if (errorData.isValid()) { - emit q->errorMessage(i18n("An error occurred while accessing '%1', the system responded: %2", - q->text(index), - errorData.toString())); - } else { - emit q->errorMessage(i18n("An error occurred while accessing '%1'", - q->text(index))); - } - emit q->setupDone(index, false); - } - -} - -void KFilePlacesModel::Private::_k_storageTeardownDone(Solid::ErrorType error, QVariant errorData) -{ - if (error && errorData.isValid()) { - emit q->errorMessage(errorData.toString()); - } -} - -} // namespace -} // namespace - -#include "moc_fileplacesmodel.cpp" diff --git a/plasma/applets/homerun/components/sources/favorites/fileplacesmodel.h b/plasma/applets/homerun/components/sources/favorites/fileplacesmodel.h deleted file mode 100644 index f6e52a49..00000000 --- a/plasma/applets/homerun/components/sources/favorites/fileplacesmodel.h +++ /dev/null @@ -1,159 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2007 Kevin Ottens - Copyright (C) 2007 David Faure - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License version 2 as published by the Free Software Foundation. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - -*/ -#ifndef KFILEPLACESMODEL_H -#define KFILEPLACESMODEL_H - -#include - -#include -#include -#include -#include - -#include - -class QMimeData; -class QAction; - -namespace Homerun -{ -namespace Fixes -{ - -/** - * This class is a list view model. Each entry represents a "place" - * where user can access files. Only revelant when - * used with QListView or QTableView. - */ -class KFILE_EXPORT KFilePlacesModel : public QAbstractItemModel -{ - Q_OBJECT -public: - enum AdditionalRoles { - UrlRole = 0x069CD12B, - HiddenRole = 0x0741CAAC, - SetupNeededRole = 0x059A935D, - FixedDeviceRole = 0x332896C1, - CapacityBarRecommendedRole = 0x1548C5C4 - }; - - KFilePlacesModel(QObject *parent=0); - ~KFilePlacesModel(); - - KUrl url(const QModelIndex &index) const; - bool setupNeeded(const QModelIndex &index) const; - KIcon icon(const QModelIndex &index) const; - QString text(const QModelIndex &index) const; - bool isHidden(const QModelIndex &index) const; - bool isDevice(const QModelIndex &index) const; - Solid::Device deviceForIndex(const QModelIndex &index) const; - KBookmark bookmarkForIndex(const QModelIndex &index) const; - - QAction *teardownActionForIndex(const QModelIndex &index) const; - QAction *ejectActionForIndex(const QModelIndex &index) const; - void requestTeardown(const QModelIndex &index); - void requestEject(const QModelIndex &index); - void requestSetup(const QModelIndex &index); - - void addPlace(const QString &text, const KUrl &url, const QString &iconName = QString(), const QString &appName = QString()); - void addPlace(const QString &text, const KUrl &url, const QString &iconName, const QString &appName, const QModelIndex &after); - void editPlace(const QModelIndex &index, const QString &text, const KUrl &url, const QString &iconName = QString(), const QString &appName = QString()); - void removePlace(const QModelIndex &index) const; - void setPlaceHidden(const QModelIndex &index, bool hidden); - - int hiddenCount() const; - - /** - * @brief Get a visible data based on Qt role for the given index. - * Return the device information for the give index. - * - * @param index The QModelIndex which contains the row, column to fetch the data. - * @param role The Interview data role(ex: Qt::DisplayRole). - * - * @return the data for the given index and role. - */ - QVariant data(const QModelIndex &index, int role) const; - - /** - * @brief Get the children model index for the given row and column. - */ - QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; - - /** - * @brief Get the parent QModelIndex for the given model child. - */ - QModelIndex parent(const QModelIndex &child) const; - - /** - * @brief Get the number of rows for a model index. - */ - int rowCount(const QModelIndex &parent = QModelIndex()) const; - - /** - * @brief Get the number of columns for a model index. - */ - int columnCount(const QModelIndex &parent = QModelIndex()) const; - - /** - * Returns the closest item for the URL \a url. - * The closest item is defined as item which is equal to - * the URL or at least is a parent URL. If there are more than - * one possible parent URL candidates, the item which covers - * the bigger range of the URL is returned. - * - * Example: the url is '/home/peter/Documents/Music'. - * Available items are: - * - /home/peter - * - /home/peter/Documents - * - * The returned item will the one for '/home/peter/Documents'. - */ - QModelIndex closestItem(const KUrl &url) const; - - - Qt::DropActions supportedDropActions() const; - Qt::ItemFlags flags(const QModelIndex &index) const; - QStringList mimeTypes() const; - QMimeData *mimeData(const QModelIndexList &indexes) const; - bool dropMimeData(const QMimeData *data, Qt::DropAction action, - int row, int column, const QModelIndex &parent); - -Q_SIGNALS: - void errorMessage(const QString &message); - void setupDone(const QModelIndex &index, bool success); - -private: - Q_PRIVATE_SLOT(d, void _k_initDeviceList()) - Q_PRIVATE_SLOT(d, void _k_deviceAdded(const QString&)) - Q_PRIVATE_SLOT(d, void _k_deviceRemoved(const QString&)) - Q_PRIVATE_SLOT(d, void _k_itemChanged(const QString&)) - Q_PRIVATE_SLOT(d, void _k_reloadBookmarks()) - Q_PRIVATE_SLOT(d, void _k_storageSetupDone(Solid::ErrorType, QVariant)) - Q_PRIVATE_SLOT(d, void _k_storageTeardownDone(Solid::ErrorType, QVariant)) - - class Private; - Private * const d; - friend class Private; -}; - -} // namespace -} // namespace - -#endif diff --git a/plasma/applets/homerun/components/sources/favorites/kfileplacesitem.cpp b/plasma/applets/homerun/components/sources/favorites/kfileplacesitem.cpp deleted file mode 100644 index f2e25c86..00000000 --- a/plasma/applets/homerun/components/sources/favorites/kfileplacesitem.cpp +++ /dev/null @@ -1,325 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2007 Kevin Ottens - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License version 2 as published by the Free Software Foundation. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - -*/ - -#include "kfileplacesitem_p.h" -#include "kfileplacesmodel.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -KFilePlacesItem::KFilePlacesItem(KBookmarkManager *manager, - const QString &address, - const QString &udi) - : m_manager(manager), m_lister(0), m_folderIsEmpty(true), m_isCdrom(false), - m_isAccessible(false), m_device(udi) -{ - setBookmark(m_manager->findByAddress(address)); - - if (udi.isEmpty() && m_bookmark.metaDataItem("ID").isEmpty()) { - m_bookmark.setMetaDataItem("ID", generateNewId()); - } else if (udi.isEmpty()) { - if (hasFullIcon(m_bookmark)) { - // TODO if this is only for the trash, it would be much faster to just read trashrc - m_lister = new KDirLister(this); - m_lister->setAutoErrorHandlingEnabled(false, 0); // don't bother the user if trash:/ doesn't exist - m_lister->setDelayedMimeTypes(true); // we don't need the mimetypes, so don't penalize other KDirLister users - connect(m_lister, SIGNAL(completed()), - this, SLOT(onListerCompleted())); - m_lister->openUrl(m_bookmark.url()); - } - } else if (!udi.isEmpty() && m_device.isValid()) { - m_access = m_device.as(); - m_volume = m_device.as(); - m_disc = m_device.as(); - m_mtp = m_device.as(); - if (m_access) { - connect(m_access, SIGNAL(accessibilityChanged(bool,QString)), - this, SLOT(onAccessibilityChanged(bool))); - onAccessibilityChanged(m_access->isAccessible()); - } - m_iconPath = m_device.icon(); - m_emblems = m_device.emblems(); - } -} - -KFilePlacesItem::~KFilePlacesItem() -{ -} - -QString KFilePlacesItem::id() const -{ - if (isDevice()) { - return bookmark().metaDataItem("UDI"); - } else { - return bookmark().metaDataItem("ID"); - } -} - -bool KFilePlacesItem::isDevice() const -{ - return !bookmark().metaDataItem("UDI").isEmpty(); -} - -KBookmark KFilePlacesItem::bookmark() const -{ - return m_bookmark; -} - -void KFilePlacesItem::setBookmark(const KBookmark &bookmark) -{ - m_bookmark = bookmark; - - if (bookmark.metaDataItem("isSystemItem") == "true") { - // This context must stay as it is - the translated system bookmark names - // are created with 'KFile System Bookmarks' as their context, so this - // ensures the right string is picked from the catalog. - // (coles, 13th May 2009) - - m_text = i18nc("KFile System Bookmarks", bookmark.text().toUtf8().data()); - } else { - m_text = bookmark.text(); - } -} - -Solid::Device KFilePlacesItem::device() const -{ - if (m_device.udi().isEmpty()) { - m_device = Solid::Device(bookmark().metaDataItem("UDI")); - if (m_device.isValid()) { - m_access = m_device.as(); - m_volume = m_device.as(); - m_disc = m_device.as(); - m_mtp = m_device.as(); - } else { - m_access = 0; - m_volume = 0; - m_disc = 0; - m_mtp = 0; - } - } - return m_device; -} - -QVariant KFilePlacesItem::data(int role) const -{ - QVariant returnData; - - if (role!=KFilePlacesModel::HiddenRole && role!=Qt::BackgroundRole && isDevice()) { - returnData = deviceData(role); - } else { - returnData = bookmarkData(role); - } - - return returnData; -} - -QVariant KFilePlacesItem::bookmarkData(int role) const -{ - KBookmark b = bookmark(); - - if (b.isNull()) return QVariant(); - - switch (role) - { - case Qt::DisplayRole: - return m_text; - case Qt::DecorationRole: - return KIcon(iconNameForBookmark(b)); - case Qt::BackgroundRole: - if (b.metaDataItem("IsHidden")=="true") { - return Qt::lightGray; - } else { - return QVariant(); - } - case KFilePlacesModel::UrlRole: - return QUrl(b.url()); - case KFilePlacesModel::SetupNeededRole: - return false; - case KFilePlacesModel::HiddenRole: - return b.metaDataItem("IsHidden")=="true"; - default: - return QVariant(); - } -} - -QVariant KFilePlacesItem::deviceData(int role) const -{ - Solid::Device d = device(); - - if (d.isValid()) { - switch (role) - { - case Qt::DisplayRole: - return d.description(); - case Qt::DecorationRole: - return KIcon(m_iconPath, 0, m_emblems); - case KFilePlacesModel::UrlRole: - if (m_access) { - return QUrl(KUrl(m_access->filePath())); - } else if (m_disc && (m_disc->availableContent() & Solid::OpticalDisc::Audio)!=0) { - QString device = d.as()->device(); - return QUrl(QString("audiocd:/?device=%1").arg(device)); - } else if (m_mtp) { - return QUrl(QString("mtp:udi=%1").arg(d.udi())); - } else { - return QVariant(); - } - case KFilePlacesModel::SetupNeededRole: - if (m_access) { - return !m_isAccessible; - } else { - return QVariant(); - } - - case KFilePlacesModel::FixedDeviceRole: - { - Solid::StorageDrive *drive = 0; - Solid::Device parentDevice = m_device; - while (parentDevice.isValid() && !drive) { - drive = parentDevice.as(); - parentDevice = parentDevice.parent(); - } - if (drive!=0) { - return !drive->isHotpluggable() && !drive->isRemovable(); - } - return true; - } - - case KFilePlacesModel::CapacityBarRecommendedRole: - return m_isAccessible && !m_isCdrom; - - default: - return QVariant(); - } - } else { - return QVariant(); - } -} - -KBookmark KFilePlacesItem::createBookmark(KBookmarkManager *manager, - const QString &label, - const KUrl &url, - const QString &iconName, - KFilePlacesItem *after) -{ - KBookmarkGroup root = manager->root(); - if (root.isNull()) - return KBookmark(); - QString empty_icon = iconName; - if (url==KUrl("trash:/")) { - if (empty_icon.endsWith(QLatin1String("-full"))) { - empty_icon.chop(5); - } else if (empty_icon.isEmpty()) { - empty_icon = "user-trash"; - } - } - KBookmark bookmark = root.addBookmark(label, url, empty_icon); - bookmark.setMetaDataItem("ID", generateNewId()); - - if (after) { - root.moveBookmark(bookmark, after->bookmark()); - } - - return bookmark; -} - -KBookmark KFilePlacesItem::createSystemBookmark(KBookmarkManager *manager, - const QString &untranslatedLabel, - const QString &translatedLabel, - const KUrl &url, - const QString &iconName) -{ - Q_UNUSED(translatedLabel); // parameter is only necessary to force the caller - // providing a translated string for the label - - KBookmark bookmark = createBookmark(manager, untranslatedLabel, url, iconName); - if (!bookmark.isNull()) - bookmark.setMetaDataItem("isSystemItem", "true"); - return bookmark; -} - - -KBookmark KFilePlacesItem::createDeviceBookmark(KBookmarkManager *manager, - const QString &udi) -{ - KBookmarkGroup root = manager->root(); - if (root.isNull()) - return KBookmark(); - KBookmark bookmark = root.createNewSeparator(); - bookmark.setMetaDataItem("UDI", udi); - bookmark.setMetaDataItem("isSystemItem", "true"); - return bookmark; -} - -QString KFilePlacesItem::generateNewId() -{ - static int count = 0; - -// return QString::number(count++); - - return QString::number(QDateTime::currentDateTime().toTime_t()) - + '/' + QString::number(count++); - - -// return QString::number(QDateTime::currentDateTime().toTime_t()) -// + '/' + QString::number(qrand()); -} - -void KFilePlacesItem::onAccessibilityChanged(bool isAccessible) -{ - m_isAccessible = isAccessible; - m_isCdrom = m_device.is() || m_device.parent().is(); - m_emblems = m_device.emblems(); - - emit itemChanged(id()); -} - -bool KFilePlacesItem::hasFullIcon(const KBookmark &bookmark) const -{ - return bookmark.url()==KUrl("trash:/"); -} - -QString KFilePlacesItem::iconNameForBookmark(const KBookmark &bookmark) const -{ - if (!m_folderIsEmpty && hasFullIcon(bookmark)) { - return bookmark.icon()+"-full"; - } else { - return bookmark.icon(); - } -} - -void KFilePlacesItem::onListerCompleted() -{ - m_folderIsEmpty = m_lister->items().isEmpty(); - emit itemChanged(id()); -} - -#include "moc_kfileplacesitem_p.cpp" diff --git a/plasma/applets/homerun/components/sources/favorites/kfileplacesitem_p.h b/plasma/applets/homerun/components/sources/favorites/kfileplacesitem_p.h deleted file mode 100644 index a0f35e9e..00000000 --- a/plasma/applets/homerun/components/sources/favorites/kfileplacesitem_p.h +++ /dev/null @@ -1,102 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2007 Kevin Ottens - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License version 2 as published by the Free Software Foundation. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - -*/ - -#ifndef KFILEPLACESITEM_P_H -#define KFILEPLACESITEM_P_H - - -#include -#include -#include -#include -#include -#include - -class KDirLister; -namespace Solid -{ -class StorageAccess; -class StorageVolume; -class OpticalDisc; -class PortableMediaPlayer; -} - -class KFilePlacesItem : public QObject -{ - Q_OBJECT -public: - KFilePlacesItem(KBookmarkManager *manager, - const QString &address, - const QString &udi = QString()); - ~KFilePlacesItem(); - - QString id() const; - - bool isDevice() const; - KBookmark bookmark() const; - void setBookmark(const KBookmark &bookmark); - Solid::Device device() const; - QVariant data(int role) const; - - static KBookmark createBookmark(KBookmarkManager *manager, - const QString &label, - const KUrl &url, - const QString &iconName, - KFilePlacesItem *after = 0); - static KBookmark createSystemBookmark(KBookmarkManager *manager, - const QString &untranslatedLabel, - const QString &translatedLabel, - const KUrl &url, - const QString &iconName); - static KBookmark createDeviceBookmark(KBookmarkManager *manager, - const QString &udi); - -Q_SIGNALS: - void itemChanged(const QString &id); - -private Q_SLOTS: - void onAccessibilityChanged(bool); - void onListerCompleted(); - -private: - QVariant bookmarkData(int role) const; - QVariant deviceData(int role) const; - - bool hasFullIcon(const KBookmark &bookmark) const; - QString iconNameForBookmark(const KBookmark &bookmark) const; - - static QString generateNewId(); - - KBookmarkManager *m_manager; - KBookmark m_bookmark; - KDirLister *m_lister; - bool m_folderIsEmpty; - bool m_isCdrom; - bool m_isAccessible; - QString m_text; - mutable Solid::Device m_device; - mutable QPointer m_access; - mutable QPointer m_volume; - mutable QPointer m_disc; - mutable QPointer m_mtp; - QString m_iconPath; - QStringList m_emblems; -}; - -#endif diff --git a/plasma/applets/homerun/components/sources/favorites/kfileplacessharedbookmarks.cpp b/plasma/applets/homerun/components/sources/favorites/kfileplacessharedbookmarks.cpp deleted file mode 100644 index a6ed2f6e..00000000 --- a/plasma/applets/homerun/components/sources/favorites/kfileplacessharedbookmarks.cpp +++ /dev/null @@ -1,281 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2008 Norbert Frese - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License version 2 as published by the Free Software Foundation. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - -*/ - -#include "kfileplacessharedbookmarks_p.h" - -#include -#include -#include -#include -#include -#include -#include - -//////////////// utility functions - -static bool compareBookmarks(const KBookmark & bookmark1, const KBookmark & bookmark2) -{ - return (bookmark1.url() == bookmark2.url() || bookmark1.text() == bookmark2.text()); -} - -static bool deepCompareDomNodes(const QDomNode & node1, const QDomNode & node2) -{ - - // compare name and value - if (node1.nodeName() != node2.nodeName() || node1.nodeValue() != node2.nodeValue()) - return false; - - // recursively compare children - const QDomNodeList node1Children = node1.childNodes(); - const QDomNodeList node2Children = node2.childNodes(); - - if (node1Children.count () != node2Children.count ()) - return false; - - for (int i=0; iroot(); - KBookmark bookmark = root.first(); - - KBookmarkGroup sharedRoot = m_sharedBookmarkManager->root(); - KBookmark sharedBookmark = sharedRoot.first(); - - bool dirty = false; - - while (!bookmark.isNull()) { - //kDebug() << "importing" << bookmark.text(); - - // skip over system items - if (bookmark.metaDataItem("isSystemItem") == "true") { - bookmark = root.next(bookmark); - continue; - } - - // do the bookmarks match? - if (!sharedBookmark.isNull() && compareBookmarks(bookmark, sharedBookmark)) { - //kDebug() << "excat comparing: targetbk:\n" << nodeAsString(bookmark.internalElement()) << "\nsourcbk:\n" << nodeAsString(sharedBookmark.internalElement()); - - if (!exactCompareBookmarks(bookmark, sharedBookmark)) { - KBookmark cloneTarget=bookmark; - KBookmark cloneSource = sharedBookmark; - - sharedBookmark = sharedRoot.next(sharedBookmark); - bookmark = root.next(bookmark); - - //kDebug() << "cloning" << cloneSource.text(); - //kDebug() << "cloning: target=\n" << nodeAsString(cloneTarget.internalElement()) << "\n source:\n" << nodeAsString(cloneSource.internalElement()); - - cloneBookmarkContents(cloneTarget, cloneSource); - dirty = true; - continue; - } else { - //kDebug() << "keeping" << bookmark.text(); - } - sharedBookmark = sharedRoot.next(sharedBookmark); - bookmark = root.next(bookmark); - continue; - } - - // they don't match -> remove - //kDebug() << "removing" << bookmark.text(); - KBookmark bookmarkToRemove = bookmark; - bookmark = root.next(bookmark); - root.deleteBookmark(bookmarkToRemove); - - dirty = true; - } - - // append the remaining shared bookmarks - while(!sharedBookmark.isNull()) { - root.addBookmark(cloneBookmark(sharedBookmark)); - sharedBookmark = sharedRoot.next(sharedBookmark); - dirty = true; - } - - return dirty; -} - -bool KFilePlacesSharedBookmarks::exportSharedBookmarks() -{ - KBookmarkGroup root = m_placesBookmarkManager->root(); - KBookmark bookmark = root.first(); - - KBookmarkGroup sharedRoot = m_sharedBookmarkManager->root(); - KBookmark sharedBookmark = sharedRoot.first(); - - bool dirty = false; - - // first check if they are the same - int count=0; - while (!bookmark.isNull()) { - //kDebug() << "exporting..." << bookmark.text(); - - // skip over system items - if (bookmark.metaDataItem("isSystemItem") == "true") { - bookmark = root.next(bookmark); - continue; - } - count++; - - // end of sharedBookmarks? - if (sharedBookmark.isNull()) { - dirty=true; - break; - } - - // do the bookmarks match? - if (compareBookmarks(bookmark, sharedBookmark)) { - if (!exactCompareBookmarks(bookmark, sharedBookmark)) { - dirty = true; - break; - } - } else { - dirty=true; - break; - } - sharedBookmark = sharedRoot.next(sharedBookmark); - bookmark = root.next(bookmark); - } - - //kDebug() << "dirty=" << dirty << " oldsize=" << bookmarkGroupSize(sharedRoot) << " count=" << count; - - if (bookmarkGroupSize(sharedRoot) != count) - dirty=true; - - if (dirty) { - emptyBookmarkGroup(sharedRoot); - - // append all bookmarks - KBookmark bookmark = root.first(); - - while(!bookmark.isNull()) { - - if (bookmark.metaDataItem("isSystemItem") == "true") { - bookmark = root.next(bookmark); - continue; - } - - sharedRoot.addBookmark(cloneBookmark(bookmark)); - bookmark = root.next(bookmark); - dirty = true; - } - } - - return dirty; - -} - -void KFilePlacesSharedBookmarks::slotSharedBookmarksChanged() -{ - //kDebug() << "shared bookmarks changed"; - bool dirty = integrateSharedBookmarks(); - if (dirty) m_placesBookmarkManager->emitChanged(); -} - -void KFilePlacesSharedBookmarks::slotBookmarksChanged() -{ - //kDebug() << "places bookmarks changed"; - bool dirty = exportSharedBookmarks(); - if (dirty) m_sharedBookmarkManager->emitChanged(); -} - -#include "moc_kfileplacessharedbookmarks_p.cpp" diff --git a/plasma/applets/homerun/components/sources/favorites/kfileplacessharedbookmarks_p.h b/plasma/applets/homerun/components/sources/favorites/kfileplacessharedbookmarks_p.h deleted file mode 100644 index ee70a443..00000000 --- a/plasma/applets/homerun/components/sources/favorites/kfileplacessharedbookmarks_p.h +++ /dev/null @@ -1,56 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2008 Norbert Frese - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License version 2 as published by the Free Software Foundation. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - -*/ - -#ifndef KFILEPLACESSHAREDBOOKMARKS_P_H -#define KFILEPLACESSHAREDBOOKMARKS_P_H - -#include -#include - -/** - * keeps the KFilePlacesModel bookmarks and the shared bookmark spec - * shortcuts in sync - */ -class KFilePlacesSharedBookmarks : public QObject -{ - Q_OBJECT -public: - - KFilePlacesSharedBookmarks(KBookmarkManager * mgr); - ~KFilePlacesSharedBookmarks() { /* delete m_sharedBookmarkManager; */} - -private: - - bool integrateSharedBookmarks(); - bool exportSharedBookmarks(); - - KBookmarkManager *m_placesBookmarkManager; - KBookmarkManager *m_sharedBookmarkManager; - -private Q_SLOTS: - - void slotSharedBookmarksChanged(); - void slotBookmarksChanged(); - -}; - - - - -#endif /*KFILEPLACESSHARED_P_H_*/ diff --git a/plasma/applets/homerun/components/sources/installedapps/changenotifier.cpp b/plasma/applets/homerun/components/sources/installedapps/changenotifier.cpp deleted file mode 100644 index fa760670..00000000 --- a/plasma/applets/homerun/components/sources/installedapps/changenotifier.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* -Copyright 2013 Aurélien Gâteau -Copyright 2013 Eike Hein - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 2 of -the License or (at your option) version 3 or any later version -accepted by the membership of KDE e.V. (or its successor approved -by the membership of KDE e.V.), which shall act as a proxy -defined in Section 14 of version 3 of the license. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ -// Self -#include - -// Local - -// KDE -#include -#include - -// Qt -#include -#include -#include - -namespace Homerun { - -ChangeNotifier::ChangeNotifier(QObject *parent) -: QObject(parent) -, mTimer(new QTimer(this)) -{ - // Use a timer to aggregate multiple KSycoca changes - mTimer->setInterval(100); - mTimer->setSingleShot(true); - connect(mTimer, SIGNAL(timeout()), SLOT(timeout())); - - connect(KSycoca::self(), SIGNAL(databaseChanged(QStringList)), SLOT(checkSycocaChanges(QStringList))); - - mWatchedProps << "appletContainmentId" << "appletContainmentMutable" - << "desktopContainmentId" << "desktopContainmentMutable"; - qApp->installEventFilter(this); -} - -ChangeNotifier::~ChangeNotifier() -{ -} - -bool ChangeNotifier::eventFilter(QObject* watched, QEvent* event) -{ - if (event->type() == QEvent::DynamicPropertyChange - && mWatchedProps.contains(static_cast(event)->propertyName())) { - emit changeDetected(false); - } - - return QObject::eventFilter(watched, event); -} - -void ChangeNotifier::checkSycocaChanges(const QStringList &changes) -{ - if (changes.contains("services") || changes.contains("apps") || changes.contains("xdgdata-apps")) { - mTimer->start(); - } -} - -void ChangeNotifier::timeout() -{ - emit changeDetected(true); -} - -} // namespace Homerun - -#include "moc_changenotifier.cpp" diff --git a/plasma/applets/homerun/components/sources/installedapps/changenotifier.h b/plasma/applets/homerun/components/sources/installedapps/changenotifier.h deleted file mode 100644 index 52f3180b..00000000 --- a/plasma/applets/homerun/components/sources/installedapps/changenotifier.h +++ /dev/null @@ -1,62 +0,0 @@ -/* -Copyright 2013 Aurélien Gâteau -Copyright 2013 Eike Hein - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 2 of -the License or (at your option) version 3 or any later version -accepted by the membership of KDE e.V. (or its successor approved -by the membership of KDE e.V.), which shall act as a proxy -defined in Section 14 of version 3 of the license. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ -#ifndef CHANGENOTIFIER_H -#define CHANGENOTIFIER_H - -// Local - -// Qt -#include -#include - -// KDE - -class QTimer; - -namespace Homerun { - -/** - * Monitor application changes from KSycoca - */ -class ChangeNotifier : public QObject -{ - Q_OBJECT -public: - explicit ChangeNotifier(QObject *parent = 0); - ~ChangeNotifier(); - - bool eventFilter(QObject *watched, QEvent *event); - -Q_SIGNALS: - void changeDetected(bool needsReload); - -private Q_SLOTS: - void checkSycocaChanges(const QStringList &changes); - void timeout(); - -private: - QTimer *mTimer; - QStringList mWatchedProps; -}; - -} // namespace Homerun - -#endif /* CHANGENOTIFIER_H */ diff --git a/plasma/applets/homerun/components/sources/installedapps/filterableinstalledappsmodel.cpp b/plasma/applets/homerun/components/sources/installedapps/filterableinstalledappsmodel.cpp deleted file mode 100644 index fb027533..00000000 --- a/plasma/applets/homerun/components/sources/installedapps/filterableinstalledappsmodel.cpp +++ /dev/null @@ -1,319 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau -Copyright 2013 Eike Hein - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -// Self -#include - -// Local -#include -#include -#include - -// KDE -#include -#include - -// Qt - -namespace Homerun { - -InstalledAppsFilterModel::InstalledAppsFilterModel(const QString &entryPath, const QString &installer, QObject *parent) -: QSortFilterProxyModel(parent) -, m_installedAppsModel(new InstalledAppsModel(entryPath, installer, this)) -, m_hidden(true) -{ - setSourceModel(m_installedAppsModel); - setDynamicSortFilter(true); - setFilterRole(InstalledAppsModel::CombinedNameRole); - setFilterCaseSensitivity(Qt::CaseInsensitive); - - connect(this, SIGNAL(modelReset()), this, SIGNAL(countChanged())); - connect(this, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SIGNAL(countChanged())); - connect(this, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SIGNAL(countChanged())); - - connect(m_installedAppsModel, SIGNAL(applicationLaunched(QString)), this, SIGNAL(applicationLaunched(QString))); -} - -InstalledAppsFilterModel::~InstalledAppsFilterModel() -{ -} - -QObject *InstalledAppsFilterModel::containment() const -{ - return m_installedAppsModel->containment(); -} - -void InstalledAppsFilterModel::setContainment(QObject *containment) -{ - m_installedAppsModel->setContainment(containment); -} - -QString InstalledAppsFilterModel::name() const -{ - return m_installedAppsModel->name(); -} - -bool InstalledAppsFilterModel::hidden() const -{ - return m_hidden; -} - -void InstalledAppsFilterModel::setHidden(bool hidden) -{ - if (hidden != m_hidden) { - m_hidden = hidden; - emit hiddenChanged(); - } -} - -int InstalledAppsFilterModel::count() const -{ - return rowCount(); -} - -void InstalledAppsFilterModel::refresh(bool reload) -{ - m_installedAppsModel->refresh(reload); -} - -bool InstalledAppsFilterModel::trigger(int row, const QString &actionId, const QVariant &actionArgument) -{ - const QModelIndex &idx = index(row, 0); - const QModelIndex &sourceIndex = mapToSource(idx); - return m_installedAppsModel->trigger(sourceIndex.row(), actionId, actionArgument); -} - -SideBarModel::SideBarModel(FilterableInstalledAppsModel *parent) -: QSortFilterProxyModel(parent) -, m_sourceModel(parent) -, m_activeSourceRow(0) -{ - setSourceModel(m_sourceModel); - setDynamicSortFilter(true); - - QHash roles; - roles.insert(Qt::DisplayRole, "display"); - roles.insert(Qt::CheckStateRole, "checked"); - - setRoleNames(roles); -} - -SideBarModel::~SideBarModel() -{ -} - -QVariant SideBarModel::data(const QModelIndex& index, int role) const -{ - QModelIndex sourceIndex = mapToSource(index); - - if (role == Qt::CheckStateRole) { - return (sourceIndex.row() == m_activeSourceRow); - } - - return QSortFilterProxyModel::data(index, role); -} - -void SideBarModel::trigger(int row) -{ - const QModelIndex &idx = index(row, 0); - const QModelIndex &sourceIndex = mapToSource(idx); - - if (sourceIndex.row() != m_activeSourceRow) { - const QModelIndex &oldActiveIndex = mapFromSource(m_sourceModel->index(m_activeSourceRow, 0)); - - m_activeSourceRow = sourceIndex.row(); - - InstalledAppsFilterModel* model = 0; - - for(int i = 0; i < m_sourceModel->rowCount(); ++i) { - model = static_cast(m_sourceModel->modelForRow(i)); - model->setHidden(i != m_activeSourceRow); - } - - emit dataChanged(oldActiveIndex, oldActiveIndex); - emit dataChanged(idx, idx); - invalidateFilter(); - } -} - -bool SideBarModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const -{ - Q_UNUSED(source_parent) - - return (m_activeSourceRow == source_row) || static_cast(m_sourceModel->modelForRow(source_row))->count(); -} - -FilterableInstalledAppsModel::FilterableInstalledAppsModel(const QString &installer, QObject *parent) -: QAbstractListModel(parent) -, m_installer(installer) -, m_sideBarModel(new SideBarModel(this)) -{ - loadRootEntries(); -} - -FilterableInstalledAppsModel::~FilterableInstalledAppsModel() -{ -} - -int FilterableInstalledAppsModel::count() const -{ - return rowCount(); -} - -QObject *FilterableInstalledAppsModel::modelForRow(int row) const -{ - if (row < 0 || row >= m_models.count()) { - kWarning() << "No model for row" << row << "!"; - return 0; - } - return m_models.value(row); -} - -void FilterableInstalledAppsModel::refresh(bool reload) -{ - if (!reload) { - foreach(InstalledAppsFilterModel* model, m_models) { - model->refresh(false); - } - - return; - } - - beginResetModel(); - qDeleteAll(m_models); - m_models.clear(); - m_pendingGroupList.clear(); - endResetModel(); - - loadRootEntries(); - - emit countChanged(); -} - -void FilterableInstalledAppsModel::loadRootEntries() -{ - InstalledAppsFilterModel *model = createInstalledAppsFilterModel(KServiceGroup::root()); - model->setHidden(false); - model->setParent(this); - beginInsertRows(QModelIndex(), m_models.count(), m_models.count()); - m_models << model; - endInsertRows(); - - KServiceGroup::Ptr group = KServiceGroup::root(); - KServiceGroup::List list = group->entries(false /* sorted: set to false as it does not seem to work */); - - QMap groupMap; - for( KServiceGroup::List::ConstIterator it = list.constBegin(); it != list.constEnd(); it++) { - const KSycocaEntry::Ptr p = (*it); - - if (p->isType(KST_KServiceGroup)) { - KServiceGroup::Ptr subGroup = KServiceGroup::Ptr::staticCast(p); - - if (!subGroup->noDisplay() && subGroup->childCount() > 0) { - groupMap.insert(subGroup->caption().toLower(), subGroup); - } - } - } - m_pendingGroupList = groupMap.values(); - QMetaObject::invokeMethod(this, "loadNextGroup", Qt::QueuedConnection); -} - -void FilterableInstalledAppsModel::loadNextGroup() -{ - if (m_pendingGroupList.isEmpty()) { - return; - } - KServiceGroup::Ptr group = m_pendingGroupList.takeFirst(); - InstalledAppsFilterModel *model = createInstalledAppsFilterModel(group); - model->setParent(this); - beginInsertRows(QModelIndex(), m_models.count(), m_models.count()); - m_models << model; - endInsertRows(); - QMetaObject::invokeMethod(this, "loadNextGroup"); -} - -int FilterableInstalledAppsModel::rowCount(const QModelIndex &parent) const -{ - if (parent.isValid()) { - return 0; - } - return m_models.count(); -} - -QVariant FilterableInstalledAppsModel::data(const QModelIndex &index, int role) const -{ - if (index.parent().isValid()) { - return QVariant(); - } - - InstalledAppsFilterModel *model = m_models.value(index.row()); - if (!model) { - return QVariant(); - } - - if (role == Qt::DisplayRole) { - return model->name(); - } else { - return QVariant(); - } -} - -SideBarModel* FilterableInstalledAppsModel::sideBarModel() const -{ - return m_sideBarModel; -} - -QString FilterableInstalledAppsModel::currentQuery() const -{ - return m_query; -} - -void FilterableInstalledAppsModel::scheduleQuery(const QString& query) -{ - emit queryChanged(query); - m_sideBarModel->invalidateFilter(); -} - -InstalledAppsFilterModel *FilterableInstalledAppsModel::createInstalledAppsFilterModel(KServiceGroup::Ptr group) -{ - InstalledAppsFilterModel *model = new InstalledAppsFilterModel(group->entryPath(), m_installer, this); - connect(this, SIGNAL(queryChanged(QString)), model, SLOT(setFilterFixedString(QString))); - connect(model, SIGNAL(applicationLaunched(QString)), this, SIGNAL(applicationLaunched(QString))); - return model; -} - -//- FilterableInstalledAppsSource -------------------------------------- -FilterableInstalledAppsSource::FilterableInstalledAppsSource(QObject *parent) -: AbstractSource(parent) -{} - -QAbstractItemModel *FilterableInstalledAppsSource::createModelFromConfigGroup(const KConfigGroup &) -{ - KConfigGroup group(config(), "PackageManagement"); - QString installer = group.readEntry("categoryInstaller"); - FilterableInstalledAppsModel *model = new FilterableInstalledAppsModel(installer); - ChangeNotifier *notifier = new ChangeNotifier(model); - connect(notifier, SIGNAL(changeDetected(bool)), model, SLOT(refresh(bool))); - return model; -} - -} // namespace Homerun - -#include "moc_filterableinstalledappsmodel.cpp" diff --git a/plasma/applets/homerun/components/sources/installedapps/filterableinstalledappsmodel.h b/plasma/applets/homerun/components/sources/installedapps/filterableinstalledappsmodel.h deleted file mode 100644 index 129eb113..00000000 --- a/plasma/applets/homerun/components/sources/installedapps/filterableinstalledappsmodel.h +++ /dev/null @@ -1,158 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau -Copyright 2013 Eike Hein - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -#ifndef FILTERABLEINSTALLEDAPPSMODEL_H -#define FILTERABLEINSTALLEDAPPSMODEL_H - -// Local -#include - -// Qt -#include - -// KDE -#include - -namespace Plasma { - class Containment; -} - -namespace Homerun { - -class InstalledAppsModel; -class FilterableInstalledAppsModel; - -class InstalledAppsFilterModel : public QSortFilterProxyModel -{ - Q_OBJECT - Q_PROPERTY(bool hidden READ hidden WRITE setHidden NOTIFY hiddenChanged) - Q_PROPERTY(int count READ count NOTIFY countChanged) - Q_PROPERTY(QString name READ name CONSTANT) - Q_PROPERTY(QObject* containment READ containment WRITE setContainment) - -public: - InstalledAppsFilterModel(const QString &entryPath, const QString &installer, QObject *parent = 0); - ~InstalledAppsFilterModel(); - - int count() const; - - Q_INVOKABLE bool trigger(int row, const QString &actionId = QString(), const QVariant &actionArgument = QVariant()); - - QObject *containment() const; - void setContainment(QObject *containment); - - QString name() const; - - bool hidden() const; - void setHidden(bool hidden); - -Q_SIGNALS: - void countChanged(); - void hiddenChanged(); - void applicationLaunched(const QString& storageId); - void addToDesktop(const QString& storageId); - void addToPanel(const QString& storageId); - -public Q_SLOTS: - void refresh(bool reload = true); - -private: - InstalledAppsModel *m_installedAppsModel; - bool m_hidden; -}; - -class SideBarModel : public QSortFilterProxyModel -{ - Q_OBJECT - -public: - explicit SideBarModel(FilterableInstalledAppsModel *parent = 0); - ~SideBarModel(); - - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; - - Q_INVOKABLE void trigger(int row); - -protected: - bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const; - -private: - FilterableInstalledAppsModel *m_sourceModel; - int m_activeSourceRow; - - friend class FilterableInstalledAppsModel; -}; - -class FilterableInstalledAppsModel : public QAbstractListModel -{ - Q_OBJECT - Q_PROPERTY(int count READ count NOTIFY countChanged) - Q_PROPERTY(QString query WRITE scheduleQuery READ currentQuery NOTIFY queryChanged) - Q_PROPERTY(QObject* sideBarModel READ sideBarModel CONSTANT) - -public: - explicit FilterableInstalledAppsModel(const QString &installer, QObject *parent = 0); - ~FilterableInstalledAppsModel(); - - int count() const; - - int rowCount(const QModelIndex &parent = QModelIndex()) const; // reimp - QVariant data(const QModelIndex &, int role = Qt::DisplayRole) const; // reimp - - QString currentQuery() const; - - SideBarModel *sideBarModel() const; - - Q_INVOKABLE QObject *modelForRow(int row) const; - -Q_SIGNALS: - void countChanged(); - void installerChanged(const QString &); - void queryChanged(const QString &); - void applicationLaunched(const QString &); - -public Q_SLOTS: - void refresh(bool reload = true); - void scheduleQuery(const QString &query); - -private Q_SLOTS: - void loadRootEntries(); - void loadNextGroup(); - -private: - QString m_installer; - QList m_pendingGroupList; - QList m_models; - SideBarModel *m_sideBarModel; - QString m_query; - - InstalledAppsFilterModel *createInstalledAppsFilterModel(KServiceGroup::Ptr group); -}; - -class FilterableInstalledAppsSource : public AbstractSource -{ -public: - FilterableInstalledAppsSource(QObject *parent); - QAbstractItemModel *createModelFromConfigGroup(const KConfigGroup &); -}; - -} // namespace Homerun - -#endif /* FILTERABLEINSTALLEDAPPSMODEL_H */ diff --git a/plasma/applets/homerun/components/sources/installedapps/groupedinstalledappsmodel.cpp b/plasma/applets/homerun/components/sources/installedapps/groupedinstalledappsmodel.cpp deleted file mode 100644 index bfd9c0bb..00000000 --- a/plasma/applets/homerun/components/sources/installedapps/groupedinstalledappsmodel.cpp +++ /dev/null @@ -1,161 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau -Copyright 2013 Eike Hein - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -// Self -#include - -// Local -#include -#include -#include - -// KDE -#include -#include - -// Qt - -namespace Homerun { - -GroupedInstalledAppsModel::GroupedInstalledAppsModel(const QString &installer, QObject *parent) -: QAbstractListModel(parent) -, m_installer(installer) -{ - loadRootEntries(); -} - -GroupedInstalledAppsModel::~GroupedInstalledAppsModel() -{ -} - -QObject *GroupedInstalledAppsModel::modelForRow(int row) const -{ - if (row < 0 || row >= m_models.count()) { - kWarning() << "No model for row" << row << "!"; - return 0; - } - return m_models.value(row); -} - -void GroupedInstalledAppsModel::refresh(bool reload) -{ - if (!reload) { - foreach(InstalledAppsModel* model, m_models) { - model->refresh(false); - } - - return; - } - - beginResetModel(); - qDeleteAll(m_models); - m_models.clear(); - m_pendingGroupList.clear(); - endResetModel(); - - loadRootEntries(); -} - -void GroupedInstalledAppsModel::loadRootEntries() -{ - KServiceGroup::Ptr group = KServiceGroup::root(); - KServiceGroup::List list = group->entries(false /* sorted: set to false as it does not seem to work */); - - QMap groupMap; - for( KServiceGroup::List::ConstIterator it = list.constBegin(); it != list.constEnd(); it++) { - const KSycocaEntry::Ptr p = (*it); - - if (p->isType(KST_KServiceGroup)) { - KServiceGroup::Ptr subGroup = KServiceGroup::Ptr::staticCast(p); - - if (!subGroup->noDisplay() && subGroup->childCount() > 0) { - groupMap.insert(subGroup->caption().toLower(), subGroup); - } - } - } - m_pendingGroupList = groupMap.values(); - QMetaObject::invokeMethod(this, "loadNextGroup", Qt::QueuedConnection); -} - -void GroupedInstalledAppsModel::loadNextGroup() -{ - if (m_pendingGroupList.isEmpty()) { - return; - } - KServiceGroup::Ptr group = m_pendingGroupList.takeFirst(); - InstalledAppsModel *model = createInstalledAppsModel(group); - model->setParent(this); - beginInsertRows(QModelIndex(), m_models.count(), m_models.count()); - m_models << model; - endInsertRows(); - QMetaObject::invokeMethod(this, "loadNextGroup", Qt::QueuedConnection); -} - -int GroupedInstalledAppsModel::rowCount(const QModelIndex &parent) const -{ - if (parent.isValid()) { - return 0; - } - return m_models.count(); -} - -QVariant GroupedInstalledAppsModel::data(const QModelIndex &index, int role) const -{ - if (index.parent().isValid()) { - return QVariant(); - } - - InstalledAppsModel *model = m_models.value(index.row()); - if (!model) { - return QVariant(); - } - - if (role == Qt::DisplayRole) { - return model->name(); - } else { - return QVariant(); - } -} - -InstalledAppsModel *GroupedInstalledAppsModel::createInstalledAppsModel(KServiceGroup::Ptr group) -{ - InstalledAppsModel *model = new InstalledAppsModel(group->entryPath(), m_installer, this); - connect(model, SIGNAL(applicationLaunched(QString)), this, SIGNAL(applicationLaunched(QString))); - return model; -} - -//- GroupedInstalledAppsSource -------------------------------------- -GroupedInstalledAppsSource::GroupedInstalledAppsSource(QObject *parent) -: AbstractSource(parent) -{} - -QAbstractItemModel *GroupedInstalledAppsSource::createModelFromConfigGroup(const KConfigGroup &) -{ - KConfigGroup group(config(), "PackageManagement"); - QString installer = group.readEntry("categoryInstaller"); - GroupedInstalledAppsModel *model = new GroupedInstalledAppsModel(installer); - ChangeNotifier *notifier = new ChangeNotifier(model); - connect(notifier, SIGNAL(changeDetected(bool)), model, SLOT(refresh(bool))); - return model; -} - -} // namespace Homerun - -#include "moc_groupedinstalledappsmodel.cpp" diff --git a/plasma/applets/homerun/components/sources/installedapps/groupedinstalledappsmodel.h b/plasma/applets/homerun/components/sources/installedapps/groupedinstalledappsmodel.h deleted file mode 100644 index 46e73b71..00000000 --- a/plasma/applets/homerun/components/sources/installedapps/groupedinstalledappsmodel.h +++ /dev/null @@ -1,80 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau -Copyright 2013 Eike Hein - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -#ifndef GROUPEDINSTALLEDAPPSMODEL_H -#define GROUPEDINSTALLEDAPPSMODEL_H - -// Local -#include - -// Qt -#include - -// KDE -#include - -namespace Homerun { - -class InstalledAppsModel; - -/** - * A model which returns all services in grouped sub-models - */ -class GroupedInstalledAppsModel : public QAbstractListModel -{ - Q_OBJECT -public: - explicit GroupedInstalledAppsModel(const QString &installer, QObject *parent = 0); - ~GroupedInstalledAppsModel(); - - int rowCount(const QModelIndex &parent = QModelIndex()) const; // reimp - QVariant data(const QModelIndex &, int role = Qt::DisplayRole) const; // reimp - - Q_INVOKABLE QObject *modelForRow(int row) const; - -Q_SIGNALS: - void installerChanged(const QString &); - void applicationLaunched(const QString &); - -public Q_SLOTS: - void refresh(bool reload = true); - -private Q_SLOTS: - void loadRootEntries(); - void loadNextGroup(); - -private: - QString m_installer; - QList m_pendingGroupList; - QList m_models; - - InstalledAppsModel *createInstalledAppsModel(KServiceGroup::Ptr group); -}; - -class GroupedInstalledAppsSource : public AbstractSource -{ -public: - GroupedInstalledAppsSource(QObject *parent); - QAbstractItemModel *createModelFromConfigGroup(const KConfigGroup &); -}; - -} // namespace Homerun - -#endif /* GROUPEDINSTALLEDAPPSMODEL_H */ diff --git a/plasma/applets/homerun/components/sources/installedapps/installedappsconfigurationwidget.cpp b/plasma/applets/homerun/components/sources/installedapps/installedappsconfigurationwidget.cpp deleted file mode 100644 index e170a95b..00000000 --- a/plasma/applets/homerun/components/sources/installedapps/installedappsconfigurationwidget.cpp +++ /dev/null @@ -1,146 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -// Self -#include - -// Local -#include - -// KDE -#include -#include -#include -#include -#include - -// Qt -#include -#include - -enum { - EntryPathRole = Qt::UserRole + 1, - SortRole, -}; - -namespace Homerun -{ - -InstalledAppsConfigurationWidget::InstalledAppsConfigurationWidget(const KConfigGroup &group) -: SourceConfigurationWidget(group) -, m_ui(new Ui_InstalledAppsConfigurationWidget) -, m_model(new QStandardItemModel(this)) -{ - // Init model - QStandardItem *defaultItem = fillModel(group.readEntry("entryPath")); - m_model->setSortRole(SortRole); - m_model->sort(0); - - m_ui->setupUi(this); - m_ui->treeView->setModel(m_model); - - // Select currently configured item - Q_ASSERT(defaultItem); - QModelIndex index = defaultItem->index(); - m_ui->treeView->selectionModel()->select(index, QItemSelectionModel::Select); - - // Expand up to the configured item - index = index.parent(); - for (; index.isValid(); index = index.parent()) { - m_ui->treeView->setExpanded(index, true); - } - - // Always expand top level - m_ui->treeView->setExpanded(m_model->index(0, 0), true); -} - -InstalledAppsConfigurationWidget::~InstalledAppsConfigurationWidget() -{ - delete m_ui; -} - -void InstalledAppsConfigurationWidget::save() -{ - QModelIndex index = m_ui->treeView->selectionModel()->currentIndex(); - if (!index.isValid()) { - kWarning() << "No item selected!"; - return; - } - QString entryPath = index.data(EntryPathRole).toString(); - configGroup().writeEntry("entryPath", entryPath); -} - - -// Helper struct for fillModel -struct ItemCreator -{ - ItemCreator() - : m_item(0) - {} - QString m_entryPath; - QStandardItem *m_item; - - void createItemChildren(QStandardItem *parent, KServiceGroup::Ptr parentGroup) - { - KServiceGroup::List list = parentGroup->entries(false /* sorted: set to false as it does not seem to work */); - - Q_FOREACH(const KSycocaEntry::Ptr entry, list) { - if (!entry->isType(KST_KServiceGroup)) { - continue; - } - KServiceGroup::Ptr group = KServiceGroup::Ptr::staticCast(entry); - - if (group->noDisplay() || group->childCount() == 0) { - continue; - } - QString entryPath = group->entryPath(); - - QStandardItem *item = new QStandardItem; - item->setText(group->caption()); - item->setIcon(KIcon(group->icon())); - item->setData(entryPath, EntryPathRole); - item->setData(group->caption().toLower(), SortRole); - - parent->appendRow(item); - createItemChildren(item, group); - - if (m_entryPath == entryPath) { - m_item = item; - } - } - } -}; - -QStandardItem *InstalledAppsConfigurationWidget::fillModel(const QString &entryPath) -{ - KServiceGroup::Ptr group = KServiceGroup::root(); - QStandardItem *rootItem = new QStandardItem; - rootItem->setText(i18n("All Applications")); - rootItem->setData(QString(), EntryPathRole); - m_model->appendRow(rootItem); - - ItemCreator creator; - creator.m_entryPath = entryPath; - creator.createItemChildren(rootItem, group); - return creator.m_item ? creator.m_item : rootItem; -} - -} // namespace Homerun - -#include "moc_installedappsconfigurationwidget.cpp" diff --git a/plasma/applets/homerun/components/sources/installedapps/installedappsconfigurationwidget.h b/plasma/applets/homerun/components/sources/installedapps/installedappsconfigurationwidget.h deleted file mode 100644 index 8520004b..00000000 --- a/plasma/applets/homerun/components/sources/installedapps/installedappsconfigurationwidget.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -#ifndef INSTALLEDAPPSCONFIGURATIONWIDGET_H -#define INSTALLEDAPPSCONFIGURATIONWIDGET_H - -// Local -#include - -// Qt - -// KDE -#include - -class QStandardItem; -class QStandardItemModel; - -class Ui_InstalledAppsConfigurationWidget; - -namespace Homerun -{ - -/** - * Configuration widget for the InstalledApps source - */ -class InstalledAppsConfigurationWidget : public SourceConfigurationWidget -{ - Q_OBJECT -public: - explicit InstalledAppsConfigurationWidget(const KConfigGroup &group); - ~InstalledAppsConfigurationWidget(); - - void save(); // reimp - -private: - Ui_InstalledAppsConfigurationWidget *m_ui; - QStandardItemModel *m_model; - - /** - * Fill m_model, returns the item which corresponds to defaultEntryPath - */ - QStandardItem *fillModel(const QString &defaultEntryPath); -}; - -} // namespace Homerun - -#endif /* INSTALLEDAPPSCONFIGURATIONWIDGET_H */ diff --git a/plasma/applets/homerun/components/sources/installedapps/installedappsconfigurationwidget.ui b/plasma/applets/homerun/components/sources/installedapps/installedappsconfigurationwidget.ui deleted file mode 100644 index e8f64ed6..00000000 --- a/plasma/applets/homerun/components/sources/installedapps/installedappsconfigurationwidget.ui +++ /dev/null @@ -1,50 +0,0 @@ - - - InstalledAppsConfigurationWidget - - - - 0 - 0 - 408 - 327 - - - - - - - Pick the application folder to display: - - - treeView - - - - - - - - 400 - 300 - - - - QAbstractItemView::NoEditTriggers - - - false - - - false - - - true - - - - - - - - diff --git a/plasma/applets/homerun/components/sources/installedapps/installedappsmodel.cpp b/plasma/applets/homerun/components/sources/installedapps/installedappsmodel.cpp deleted file mode 100644 index d095016c..00000000 --- a/plasma/applets/homerun/components/sources/installedapps/installedappsmodel.cpp +++ /dev/null @@ -1,484 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau -Copyright 2013 Eike Hein - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -// Local -#include -#include -#include -#include -#include -#include - -// Qt -#include -#include -#include -#include - -// KDE -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -namespace Homerun { - -static const char *SOURCE_ID = "InstalledApps"; - -//- AbstractNode --------------------------------------------------------------- -AbstractNode::~AbstractNode() -{ -} - -bool AbstractNode::lessThan(AbstractNode *n1, AbstractNode *n2) -{ - Q_ASSERT(n1); - Q_ASSERT(n2); - return n1->m_sortKey < n2->m_sortKey; -} - -//- GroupNode ------------------------------------------------------------------ -GroupNode::GroupNode(KServiceGroup::Ptr group, InstalledAppsModel *model) -: m_model(model) -{ - m_icon = group->icon(); - m_name = group->caption(); - m_entryPath = group->entryPath(); - m_sortKey = m_name.toLower(); -} - -bool GroupNode::trigger(const QString &actionId, const QVariant &actionArgument) -{ - Q_UNUSED(actionId) - Q_UNUSED(actionArgument) - - QVariantMap args; - args.insert("entryPath", m_entryPath); - m_model->openSourceRequested(SOURCE_ID, args); - return false; -} - -//- AppNode -------------------------------------------------------------------- -AppNode::AppNode(KService::Ptr service, InstalledAppsModel *model) -: m_model(model) -, m_service(service) -{ - m_icon = service->icon(); - m_name = service->name(); - m_genericName = service->genericName(); - m_service = service; - m_sortKey = m_name.toLower(); -} - -bool AppNode::trigger(const QString &actionId, const QVariant &actionArgument) -{ - Q_UNUSED(actionArgument) - - if (!actionId.isEmpty()) { - QVariant adaptor = qApp->property("HomerunViewerAdaptor"); - - if (adaptor.isValid()) { - uint containmentId = (actionId == "addToDesktop") ? qApp->property("desktopContainmentId").toUInt() - : qApp->property("appletContainmentId").toUInt(); - return QMetaObject::invokeMethod(adaptor.value(), actionId.toLocal8Bit(), - Qt::DirectConnection, Q_ARG(uint, containmentId), Q_ARG(QString, m_service->storageId())); - } else if (m_model->containment()) { - Plasma::Containment *containment = static_cast(m_model->containment()); - - if (actionId == "addToDesktop") { - Plasma::Containment *desktop = containment->corona()->containmentForScreen(containment->screen()); - - if (desktop) { - if (desktop->metaObject()->indexOfSlot("addUrls(KUrl::List)") != -1) { - QMetaObject::invokeMethod(desktop, "addUrls", - Qt::DirectConnection, Q_ARG(KUrl::List, KUrl::List(m_service->entryPath()))); - } else { - desktop->addApplet("icon", QVariantList() << m_service->entryPath()); - } - } - } else if (actionId == "addToPanel") { - QRectF rect(containment->geometry().width() / 3, 0, 150, - containment->boundingRect().height()); - containment->addApplet("icon", QVariantList() << m_service->entryPath(), rect); - } else if (actionId == "addLauncher") { - QObject* taskManager = 0; - - foreach(QObject* applet, containment->applets()) { - if (applet->metaObject()->indexOfSlot("addLauncher(QString)") != -1) { - taskManager = applet; - } - } - - if (taskManager) { - QMetaObject::invokeMethod(taskManager, "addLauncher", Qt::DirectConnection, - Q_ARG(QString, m_service->storageId())); - } - } - } - } else { - bool ran = KRun::run(*m_service, KUrl::List(), 0); - - if (ran) { - emit m_model->applicationLaunched(m_service->storageId()); - } - - return ran; - } - - return false; -} - -QString AppNode::favoriteId() const -{ - return QString("app:") + m_service->storageId(); -} - -KService::Ptr AppNode::service() const -{ - return m_service; -} - -//- InstallerNode -------------------------------------------------------------- -InstallerNode::InstallerNode(KServiceGroup::Ptr group, KService::Ptr installerService) -: m_group(group) -, m_service(installerService) -{ - m_icon = m_service->icon(); - m_name = m_service->name(); -} - -bool InstallerNode::trigger(const QString &actionId, const QVariant &actionArgument) -{ - Q_UNUSED(actionId) - Q_UNUSED(actionArgument) - - QHash map; - QString category = m_group->entryPath(); - if (category.endsWith('/')) { - category.truncate(category.length() - 1); - } - map.insert("category", category); - - QString command = KMacroExpander::expandMacros(m_service->exec(), map, '@'); - return KRun::run(command, KUrl::List(), 0, m_service->name(), m_service->icon()); -} - -//- InstalledAppsModel ------------------------------------------------------------ -InstalledAppsModel::InstalledAppsModel(const QString &entryPath, const QString &installer, QObject *parent) -: QAbstractListModel(parent) -, m_entryPath(entryPath) -, m_pathModel(new PathModel(this)) -, m_installer(installer) -, m_containment(0) -{ - QHash roles; - roles.insert(Qt::DisplayRole, "display"); - roles.insert(Qt::DecorationRole, "decoration"); - roles.insert(FavoriteIdRole, "favoriteId"); - roles.insert(HasActionListRole, "hasActionList"); - roles.insert(ActionListRole, "actionList"); - roles.insert(GenericNameRole, "genericName"); - - setRoleNames(roles); - - refresh(); -} - -InstalledAppsModel::~InstalledAppsModel() -{ - qDeleteAll(m_nodeList); -} - -QObject* InstalledAppsModel::containment() const -{ - return m_containment; -} - -void InstalledAppsModel::setContainment(QObject* containment) -{ - m_containment = containment; -} - -int InstalledAppsModel::rowCount(const QModelIndex& index) const -{ - return index.isValid() ? 0 : m_nodeList.count(); -} - -int InstalledAppsModel::count() const -{ - return m_nodeList.count(); -} - -QVariant InstalledAppsModel::data(const QModelIndex &index, int role) const -{ - if (!index.isValid() || index.row() >= m_nodeList.count()) { - return QVariant(); - } - - AbstractNode *node = m_nodeList.at(index.row()); - if (role == Qt::DisplayRole) { - return node->name(); - } else if (role == Qt::DecorationRole) { - // at least show the oxygen question-mark, otherwise it looks weird blank. - return node->icon().isEmpty() ? QLatin1String("unknown") : node->icon(); - } else if (role == FavoriteIdRole) { - return node->favoriteId(); - } else if (role == HasActionListRole) { - return node->type() == AbstractNode::AppNodeType; - } else if (role == ActionListRole && node->type() == AbstractNode::AppNodeType) { - QVariantList actionList; - - if (qApp->property("HomerunViewerAdaptor").isValid()) - { - if (qApp->property("desktopContainmentId").toUInt() > 0 - && qApp->property("desktopContainmentMutable").toBool()) { - actionList << ActionList::createActionItem(i18n("Add to Desktop"), "addToDesktop"); - } - if (qApp->property("appletContainmentId").toUInt() > 0 - && qApp->property("appletContainmentMutable").toBool()) { - actionList << ActionList::createActionItem(i18n("Add to Panel"), "addToPanel"); - } - } else if (m_containment) { - Plasma::Containment *containment = static_cast(m_containment); - Plasma::Containment *desktop = containment->corona()->containmentForScreen(containment->screen()); - - if (desktop && desktop->immutability() == Plasma::Mutable) { - actionList << ActionList::createActionItem(i18n("Add to Desktop"), "addToDesktop"); - } - - if (containment->immutability() == Plasma::Mutable) { - actionList << ActionList::createActionItem(i18n("Add to Panel"), "addToPanel"); - } - - QObject* taskManager = 0; - - foreach(QObject* applet, containment->applets()) { - if (applet->metaObject()->indexOfSlot("hasLauncher(QString)") != -1) { - taskManager = applet; - } - } - - if (taskManager) { - AppNode* appNode = static_cast(node); - - bool hasLauncher = false; - - QMetaObject::invokeMethod(taskManager, "hasLauncher", Qt::DirectConnection, - Q_RETURN_ARG(bool, hasLauncher), Q_ARG(QString, appNode->service()->storageId())); - - if (!hasLauncher) { - actionList << ActionList::createActionItem(i18n("Add as Launcher"), "addLauncher"); - } - } - } - - return actionList; - } else if (role == GenericNameRole && node->type() == AbstractNode::AppNodeType) { - return static_cast(node)->genericName(); - } else if (role == CombinedNameRole && node->type() == AbstractNode::AppNodeType) { - AppNode *appNode = static_cast(node); - return QString(appNode->name() + ' ' + appNode->genericName()); - } - - return QVariant(); -} - -bool InstalledAppsModel::trigger(int row, const QString &actionId, const QVariant &actionArgument) -{ - return m_nodeList.at(row)->trigger(actionId, actionArgument); -} - -void InstalledAppsModel::refresh(bool reload) -{ - if (!reload) { - emit layoutAboutToBeChanged(); - emit layoutChanged(); - - return; - } - - m_pathModel->clear(); - beginResetModel(); - qDeleteAll(m_nodeList); - m_nodeList.clear(); - - if (m_entryPath.isEmpty()) { - loadRootEntries(); - } else { - KServiceGroup::Ptr group = KServiceGroup::group(m_entryPath); - loadServiceGroup(group); - QVariantMap args; - args.insert("entryPath", m_entryPath); - QString label = (m_entryPath == KServiceGroup::root()->entryPath()) ? i18n("All Applications") - : group->caption(); - m_pathModel->addPath(label, SOURCE_ID, args); - } - - endResetModel(); - - emit countChanged(); -} - -void InstalledAppsModel::loadRootEntries() -{ - KServiceGroup::Ptr group = KServiceGroup::root(); - KServiceGroup::List list = group->entries(false /* sorted: set to false as it does not seem to work */); - - for( KServiceGroup::List::ConstIterator it = list.constBegin(); it != list.constEnd(); it++) { - const KSycocaEntry::Ptr p = (*it); - - if (p->isType(KST_KServiceGroup)) { - KServiceGroup::Ptr subGroup = KServiceGroup::Ptr::staticCast(p); - - if (!subGroup->noDisplay() && subGroup->childCount() > 0) { - m_nodeList << new GroupNode(subGroup, this); - } - } - } - qSort(m_nodeList.begin(), m_nodeList.end(), AbstractNode::lessThan); -} - -void InstalledAppsModel::loadServiceGroup(KServiceGroup::Ptr group) -{ - doLoadServiceGroup(group); - - qSort(m_nodeList.begin(), m_nodeList.end(), AbstractNode::lessThan); - - if (!m_installer.isEmpty()) { - KService::Ptr service = KService::serviceByDesktopName(m_installer); - if (service) { - m_nodeList << new InstallerNode(group, service); - } else { - kWarning() << "Could not find service for" << m_installer; - } - } -} - -void InstalledAppsModel::doLoadServiceGroup(KServiceGroup::Ptr group) -{ - /* This method is separate from loadServiceGroup so that - * - only one installer node is added at the end - * - sorting is done only once - */ - if (!group || !group->isValid()) { - return; - } - - KServiceGroup::List list = group->entries(false /* see above */); - - for( KServiceGroup::List::ConstIterator it = list.constBegin(); - it != list.constEnd(); it++) { - const KSycocaEntry::Ptr p = (*it); - - if (p->isType(KST_KService)) { - const KService::Ptr service = KService::Ptr::staticCast(p); - - if (!service->noDisplay()) { - QString genericName = service->genericName(); - if (genericName.isNull()) { - genericName = service->comment(); - } - - bool found = false; - - foreach(const AbstractNode *node, m_nodeList) { - if (node->type() == AbstractNode::AppNodeType - && static_cast(node)->service()->storageId() == service->storageId()) { - found = true; - } - } - - if (!found) { - m_nodeList << new AppNode(service, this); - } - } - - } else if (p->isType(KST_KServiceGroup)) { - const KServiceGroup::Ptr subGroup = KServiceGroup::Ptr::staticCast(p); - - if (!subGroup->noDisplay() && subGroup->childCount() > 0) { - doLoadServiceGroup(subGroup); - } - } - } -} - -PathModel *InstalledAppsModel::pathModel() const -{ - return m_pathModel; -} - -QString InstalledAppsModel::name() const -{ - if (m_pathModel->count() > 0) { - QModelIndex index = m_pathModel->index(m_pathModel->count() - 1, 0); - return index.data().toString(); - } else { - return i18n("Applications"); - } -} - -//- InstalledAppsSource --------------------------------------------- -InstalledAppsSource::InstalledAppsSource(QObject *parent) -: AbstractSource(parent) -{} - -QAbstractItemModel *InstalledAppsSource::createModelFromConfigGroup(const KConfigGroup &group) -{ - QString entryPath = group.readEntry("entryPath"); - return createModel(entryPath); -} - -QAbstractItemModel *InstalledAppsSource::createModelFromArguments(const QVariantMap &arguments) -{ - QString entryPath = arguments.value("entryPath").toString(); - return createModel(entryPath); -} - -QAbstractItemModel *InstalledAppsSource::createModel(const QString &entryPath) -{ - KConfigGroup group(config(), "PackageManagement"); - QString installer = group.readEntry("categoryInstaller"); - - InstalledAppsModel *model = new InstalledAppsModel(entryPath, installer); - ChangeNotifier *notifier = new ChangeNotifier(model); - connect(notifier, SIGNAL(changeDetected(bool)), model, SLOT(refresh(bool))); - return model; -} - -bool InstalledAppsSource::isConfigurable() const -{ - return true; -} - -SourceConfigurationWidget *InstalledAppsSource::createConfigurationWidget(const KConfigGroup &group) -{ - return new InstalledAppsConfigurationWidget(group); -} - -} // namespace Homerun - -#include "moc_installedappsmodel.cpp" diff --git a/plasma/applets/homerun/components/sources/installedapps/installedappsmodel.h b/plasma/applets/homerun/components/sources/installedapps/installedappsmodel.h deleted file mode 100644 index 52783866..00000000 --- a/plasma/applets/homerun/components/sources/installedapps/installedappsmodel.h +++ /dev/null @@ -1,190 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau -Copyright 2013 Eike Hein - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -#ifndef INSTALLEDAPPSMODEL_H -#define INSTALLEDAPPSMODEL_H - -// Local -#include - -// Qt -#include -#include -#include - -// KDE -#include -#include -#include -#include - -namespace Homerun { - -class PathModel; - -class InstalledAppsModel; -class InstalledAppsSource; - -class AbstractNode -{ -public: - enum NodeType { AppNodeType, GroupNodeType, InstallerNodeType }; - - virtual ~AbstractNode(); - - virtual NodeType type() const = 0; - - virtual bool trigger(const QString &actionId = QString(), const QVariant &actionArgument = QVariant()) = 0; - virtual QString favoriteId() const { return QString(); } - - QString icon() const { return m_icon; } - QString name() const { return m_name; } - QString genericName() const { return m_genericName; } - - static bool lessThan(AbstractNode *n1, AbstractNode *n2); - -protected: - QString m_sortKey; - QString m_icon; - QString m_name; - QString m_genericName; -}; - -class GroupNode : public AbstractNode -{ -public: - GroupNode(KServiceGroup::Ptr group, InstalledAppsModel *model); - - NodeType type() const { return GroupNodeType; } - - bool trigger(const QString &actionId = QString(), const QVariant &actionArgument = QVariant()); // reimp - -private: - InstalledAppsModel *m_model; - QString m_entryPath; -}; - -class AppNode : public AbstractNode -{ -public: - AppNode(KService::Ptr service, InstalledAppsModel *model); - - NodeType type() const { return AppNodeType; } - - bool trigger(const QString &actionId = QString(), const QVariant &actionArgument = QVariant()); // reimp; - QString favoriteId() const; // reimp - - KService::Ptr service() const; - -private: - InstalledAppsModel *m_model; - KService::Ptr m_service; -}; - -class InstallerNode : public AbstractNode -{ -public: - InstallerNode(KServiceGroup::Ptr group, KService::Ptr installerService); - - NodeType type() const { return InstallerNodeType; } - - bool trigger(const QString &actionId = QString(), const QVariant &actionArgument = QVariant()); // reimp; - -private: - InstalledAppsModel *m_model; - KServiceGroup::Ptr m_group; - KService::Ptr m_service; -}; - -class InstalledAppsModel : public QAbstractListModel -{ - Q_OBJECT - Q_PROPERTY(int count READ count NOTIFY countChanged) - Q_PROPERTY(QObject* pathModel READ pathModel CONSTANT) - Q_PROPERTY(QString name READ name CONSTANT) - Q_PROPERTY(QObject* containment READ containment WRITE setContainment) - -public: - enum Roles { - FavoriteIdRole = Qt::UserRole + 1, - HasActionListRole, - ActionListRole, - GenericNameRole, - CombinedNameRole - }; - - InstalledAppsModel(const QString &entryPath, const QString &installer, QObject *parent = 0); - ~InstalledAppsModel(); - - int rowCount(const QModelIndex &parent = QModelIndex()) const; - int count() const; - QVariant data(const QModelIndex &, int) const; - - PathModel *pathModel() const; - - Q_INVOKABLE bool trigger(int row, const QString &actionId = QString(), const QVariant &actionArgument = QVariant()); - - QObject *containment() const; - void setContainment(QObject *containment); - - QString name() const; - -Q_SIGNALS: - void countChanged(); - void openSourceRequested(const QString &sourceId, const QVariantMap &args); - void applicationLaunched(const QString& storageId); - -public Q_SLOTS: - void refresh(bool reload = true); - -private: - void loadRootEntries(); - void loadServiceGroup(KServiceGroup::Ptr group); - void doLoadServiceGroup(KServiceGroup::Ptr group); - - QString m_entryPath; - PathModel *m_pathModel; - QList m_nodeList; - QString m_installer; - QString m_arguments; - - QObject *m_containment; - - friend class GroupNode; - friend class AppNode; -}; - -class InstalledAppsSource : public AbstractSource -{ -public: - InstalledAppsSource(QObject *parent); - QAbstractItemModel *createModelFromConfigGroup(const KConfigGroup &group); // reimp - QAbstractItemModel *createModelFromArguments(const QVariantMap &arguments); // reimp - - bool isConfigurable() const; // reimp - SourceConfigurationWidget *createConfigurationWidget(const KConfigGroup &group); // reimp - -private: - QAbstractItemModel *createModel(const QString &entryPath); -}; - -} // namespace Homerun - -#endif diff --git a/plasma/applets/homerun/components/sources/power/combinedpowersessionmodel.cpp b/plasma/applets/homerun/components/sources/power/combinedpowersessionmodel.cpp deleted file mode 100644 index 4cdfda30..00000000 --- a/plasma/applets/homerun/components/sources/power/combinedpowersessionmodel.cpp +++ /dev/null @@ -1,321 +0,0 @@ -/* - * Copyright 2013 Eike Hein - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "combinedpowersessionmodel.h" -#include "actionlist.h" -#include "powermodel.h" -#include "sessionmodel.h" - -#include -#include - -namespace Homerun { - -PowerSessionFavoritesModel::PowerSessionFavoritesModel(const KConfigGroup &group, CombinedPowerSessionModel *parent) : QAbstractListModel(parent) -, m_configGroup(group) -, m_combinedPowerSessionModel(parent) -{ - setRoleNames(m_combinedPowerSessionModel->roleNames()); - - readConfig(); -} - -PowerSessionFavoritesModel::~PowerSessionFavoritesModel() -{ -} - -void PowerSessionFavoritesModel::readConfig() -{ - beginResetModel(); - - m_favorites.clear(); - - QStringList favoriteIds = m_configGroup.readEntry("Favorites", QList() << "logout" << "restart" << "shutdown"); - - const QModelIndex &start = m_combinedPowerSessionModel->index(0, 0); - - foreach(const QString &favoriteId, favoriteIds) { - QModelIndexList indices = m_combinedPowerSessionModel->match(start, CombinedPowerSessionModel::FavoriteIdRole, - favoriteId, 1, Qt::MatchExactly); - - if (indices.count()) { - m_favorites.append(QPersistentModelIndex(indices.at(0))); - } - } - - endResetModel(); - - emit countChanged(); - - writeConfig(); -} - -void PowerSessionFavoritesModel::writeConfig() -{ - QStringList favoriteIds; - - foreach(const QPersistentModelIndex &index, m_favorites) { - favoriteIds << index.data(CombinedPowerSessionModel::FavoriteIdRole).toString(); - } - - m_configGroup.writeEntry("Favorites", favoriteIds); - m_configGroup.config()->sync(); -} - -int PowerSessionFavoritesModel::count() const -{ - return rowCount(); -} - -int PowerSessionFavoritesModel::rowCount(const QModelIndex &parent) const -{ - return parent.isValid() ? 0 : m_favorites.count(); -} - -bool PowerSessionFavoritesModel::canMoveRow() const -{ - return true; -} - -QVariant PowerSessionFavoritesModel::data(const QModelIndex &index, int role) const -{ - if (!index.isValid() || index.row() > m_favorites.count() - 1) { - return QVariant(); - } - - return m_favorites.at(index.row()).data(role); -} - -bool PowerSessionFavoritesModel::trigger(int row, const QString &actionId, const QVariant &) -{ - if (row > m_favorites.count() - 1) { - return false; - } - - return m_combinedPowerSessionModel->trigger(m_favorites.at(row).row(), actionId, QString()); -} - -void PowerSessionFavoritesModel::moveRow(int from, int to) -{ - beginMoveRows(QModelIndex(), from, from, QModelIndex(), to > from ? to + 1 : to); - - m_favorites.move(from, to); - - endMoveRows(); - - writeConfig(); -} - -void PowerSessionFavoritesModel::addFavorite(const QModelIndex &index) -{ - QString favoriteId = index.data(CombinedPowerSessionModel::FavoriteIdRole).toString(); - - if (favoriteId.isEmpty()) { - return; - } - - beginInsertRows(QModelIndex(), m_favorites.count(), m_favorites.count()); - - m_favorites.append(QPersistentModelIndex(index)); - - endInsertRows(); - - emit countChanged(); - - writeConfig(); -} - -void PowerSessionFavoritesModel::removeFavorite(const QModelIndex &index) -{ - int row = m_favorites.indexOf(index); - - if (row != -1) { - beginRemoveRows(QModelIndex(), row, row); - - m_favorites.removeAt(row); - - endRemoveRows(); - - emit countChanged(); - - writeConfig(); - } -} - -bool PowerSessionFavoritesModel::isFavorite(const QModelIndex &index) -{ - return m_favorites.contains(index); -} - -QString PowerSessionFavoritesModel::name() const -{ - return m_combinedPowerSessionModel->name(); -} - -CombinedPowerSessionModel::CombinedPowerSessionModel(const KConfigGroup &group, QObject *parent) : QAbstractListModel(parent) -, m_sessionModel(new SessionModel(this)) -, m_powerModel(new PowerModel(this)) -, m_showFavoritesActions(false) -{ - QHash roles; - roles.insert(Qt::DisplayRole, "display"); - roles.insert(Qt::DecorationRole, "decoration"); - roles.insert(HasActionListRole, "hasActionList"); - roles.insert(ActionListRole, "actionList"); - - setRoleNames(roles); - - m_favoriteIdMapping["system-lock-screen"] = "lock-screen"; - m_favoriteIdMapping["system-log-out"] = "logout"; - m_favoriteIdMapping["system-switch-user"] = "switch-user"; - m_favoriteIdMapping["system-suspend"] = "suspend"; - m_favoriteIdMapping["system-suspend-hibernate"] = "hibernate"; - m_favoriteIdMapping["system-reboot"] = "restart"; - m_favoriteIdMapping["system-shutdown"] = "shutdown"; - - m_favoritesModel = new PowerSessionFavoritesModel(group, this); - - connect(m_sessionModel, SIGNAL(rowsInserted(QModelIndex,int,int)), SIGNAL(countChanged())); - connect(m_sessionModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), SIGNAL(countChanged())); - connect(m_sessionModel, SIGNAL(modelReset()), SIGNAL(countChanged())); - - connect(m_powerModel, SIGNAL(rowsInserted(QModelIndex,int,int)), SIGNAL(countChanged())); - connect(m_powerModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), SIGNAL(countChanged())); - connect(m_powerModel, SIGNAL(modelReset()), SIGNAL(countChanged())); -} - -CombinedPowerSessionModel::~CombinedPowerSessionModel() -{ -} - -int CombinedPowerSessionModel::count() const -{ - return rowCount(); -} - -int CombinedPowerSessionModel::rowCount(const QModelIndex &parent) const -{ - return parent.isValid() ? 0 : (m_powerModel->count() + m_sessionModel->count()); -} - -QVariant CombinedPowerSessionModel::data(const QModelIndex &index, int role) const -{ - if (role == FavoriteIdRole) { - QString iconName; - - if (index.row() >= m_sessionModel->count()) { - iconName = m_powerModel->data(m_powerModel->index(index.row() - m_sessionModel->count(), - index.column()), Qt::DecorationRole).toString(); - } else { - iconName = m_sessionModel->data(m_sessionModel->index(index.row(), index.column()), - Qt::DecorationRole).toString(); - } - - if (m_favoriteIdMapping.contains(iconName)) { - return m_favoriteIdMapping[iconName]; - } else { - return 0; - } - } else if (role == HasActionListRole) { - return m_showFavoritesActions; - } else if (role == ActionListRole) { - QVariantList actionList; - QVariantMap action; - - if (m_favoritesModel->isFavorite(index)) { - action = ActionList::createActionItem(i18n("Remove from Sidebar"), "removeFromFavorites"); - action["icon"] = KIcon("list-remove"); - actionList << action; - } else { - action = ActionList::createActionItem(i18n("Add to Sidebar"), "addToFavorites"); - action["icon"] = KIcon("bookmark-new"); - actionList << action; - } - - return actionList; - } - - if (index.row() >= m_sessionModel->count()) { - return m_powerModel->data(m_powerModel->index(index.row() - m_sessionModel->count(), index.column()), role); - } - - return m_sessionModel->data(m_sessionModel->index(index.row(), index.column()), role); -} - -bool CombinedPowerSessionModel::trigger(int row, const QString &actionId, const QVariant &) -{ - if (actionId == "addToFavorites") { - QModelIndex idx = index(row); - - m_favoritesModel->addFavorite(idx); - - emit dataChanged(idx, idx); - - return false; - } else if (actionId == "removeFromFavorites") { - QModelIndex idx = index(row); - - m_favoritesModel->removeFavorite(idx); - emit dataChanged(idx, idx); - - return false; - } - - if (row >= m_sessionModel->count()) { - return m_powerModel->trigger(row - m_sessionModel->count(), QString(), QVariant()); - } - - return m_sessionModel->trigger(row, QString(), QVariant()); -} - -bool CombinedPowerSessionModel::showFavoritesActions() const -{ - return m_showFavoritesActions; -} - -void CombinedPowerSessionModel::setShowFavoritesActions(bool show) -{ - if (show != m_showFavoritesActions) { - m_showFavoritesActions = show; - - emit dataChanged(index(0), index(count() - 1)); - } -} - -QObject *CombinedPowerSessionModel::favoritesModel() const -{ - return m_favoritesModel; -} - -QString CombinedPowerSessionModel::name() const -{ - return i18n("Power / Session"); -} - -CombinedPowerSessionSource::CombinedPowerSessionSource(QObject *parent) : AbstractSource(parent) -{ -} - -QAbstractItemModel *CombinedPowerSessionSource::createModelFromConfigGroup(const KConfigGroup &group) -{ - return new CombinedPowerSessionModel(group); -} - -} - -#include "moc_combinedpowersessionmodel.cpp" diff --git a/plasma/applets/homerun/components/sources/power/combinedpowersessionmodel.h b/plasma/applets/homerun/components/sources/power/combinedpowersessionmodel.h deleted file mode 100644 index eb5d37ad..00000000 --- a/plasma/applets/homerun/components/sources/power/combinedpowersessionmodel.h +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright 2013 Eike Hein - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef COMBINEDPOWERSESSIONMODEL_H -#define COMBINEDPOWERSESSIONMODEL_H - -#include - -#include - -#include - -namespace Homerun { - -class PowerModel; -class SessionModel; -class CombinedPowerSessionModel; - -class PowerSessionFavoritesModel : public QAbstractListModel -{ - Q_OBJECT - - Q_PROPERTY(int count READ count NOTIFY countChanged) - Q_PROPERTY(QString name READ name CONSTANT) - Q_PROPERTY(bool canMoveRow READ canMoveRow CONSTANT) - - public: - PowerSessionFavoritesModel(const KConfigGroup &group, CombinedPowerSessionModel *parent = 0); - ~PowerSessionFavoritesModel(); - - int count() const; - int rowCount(const QModelIndex& parent = QModelIndex()) const; - - bool canMoveRow() const; - - QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const; - - Q_INVOKABLE bool trigger(int row, const QString &actionId, const QVariant &/*actionArgument*/); - - Q_INVOKABLE void moveRow(int from, int to); - - void addFavorite(const QModelIndex &index); - void removeFavorite(const QModelIndex &index); - bool isFavorite(const QModelIndex &index); - - QString name() const; - - signals: - void countChanged(); - - private: - void readConfig(); - void writeConfig(); - - KConfigGroup m_configGroup; - - QList m_favorites; - CombinedPowerSessionModel* m_combinedPowerSessionModel; -}; - -class CombinedPowerSessionModel : public QAbstractListModel -{ - Q_OBJECT - - Q_PROPERTY(int count READ count NOTIFY countChanged) - Q_PROPERTY(QString name READ name CONSTANT) - Q_PROPERTY(bool showFavoritesActions READ showFavoritesActions WRITE setShowFavoritesActions) - - public: - enum Roles { - FavoriteIdRole = Qt::UserRole + 1, - HasActionListRole, - ActionListRole - }; - - CombinedPowerSessionModel(const KConfigGroup &group, QObject *parent = 0); - ~CombinedPowerSessionModel(); - - int count() const; - int rowCount(const QModelIndex& parent = QModelIndex()) const; - - QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const; - - Q_INVOKABLE bool trigger(int row, const QString &actionId, const QVariant &/*actionArgument*/); - - bool showFavoritesActions() const; - void setShowFavoritesActions(bool show); - Q_INVOKABLE QObject *favoritesModel() const; - - QString name() const; - - signals: - void countChanged(); - - private: - SessionModel *m_sessionModel; - PowerModel *m_powerModel; - - QHash m_favoriteIdMapping; - PowerSessionFavoritesModel* m_favoritesModel; - bool m_showFavoritesActions; -}; - -class CombinedPowerSessionSource : public AbstractSource -{ - public: - CombinedPowerSessionSource(QObject *parent); - QAbstractItemModel *createModelFromConfigGroup(const KConfigGroup &group); -}; - -} - -#endif diff --git a/plasma/applets/homerun/components/sources/power/powermodel.cpp b/plasma/applets/homerun/components/sources/power/powermodel.cpp deleted file mode 100644 index 6425a81b..00000000 --- a/plasma/applets/homerun/components/sources/power/powermodel.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - Copyright 2012 Aurélien Gâteau - Copyright (C) 2012 Shaun Reich - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -// Own -#include "powermodel.h" - -// KDE -#include -#include -#include -#include - -namespace Homerun { - -enum Action -{ - SuspendToRam, - SuspendToDisk, - Reboot, - Halt -}; - -PowerModel::PowerModel(QObject *parent) -: StandardItemModel(parent) -{ - setName(i18n("Power")); - QSet sleepStates = Solid::PowerManagement::supportedSleepStates(); - - if (sleepStates.contains(Solid::PowerManagement::SuspendState)) { - StandardItem *item = new StandardItem(i18nc("an action", "Suspend"), "system-suspend"); - item->setData(SuspendToRam); - appendRow(item); - } - - if (sleepStates.contains(Solid::PowerManagement::HibernateState)) { - StandardItem *item = new StandardItem(i18nc("an action", "Hibernate"), "system-suspend-hibernate"); - item->setData(SuspendToDisk); - appendRow(item); - } - - { - StandardItem *item = new StandardItem(i18nc("an action", "Restart"), "system-reboot"); - item->setData(Reboot); - appendRow(item); - } - { - StandardItem *item = new StandardItem(i18nc("an action", "Shutdown"), "system-shutdown"); - item->setData(Halt); - appendRow(item); - } -} - -bool PowerModel::trigger(int row, const QString &/*actionId*/, const QVariant &/*actionArgument*/) -{ - QStandardItem *itm = item(row); - Q_ASSERT(itm); - Action action = static_cast(itm->data().toInt()); - switch (action) { - case SuspendToRam: - Solid::PowerManagement::requestSleep(Solid::PowerManagement::SuspendState, 0, 0); - break; - case SuspendToDisk: - Solid::PowerManagement::requestSleep(Solid::PowerManagement::HibernateState, 0, 0); - break; - case Halt: - KWorkSpace::requestShutDown(KWorkSpace::ShutdownConfirmDefault, KWorkSpace::ShutdownTypeHalt); - break; - case Reboot: - KWorkSpace::requestShutDown(KWorkSpace::ShutdownConfirmDefault, KWorkSpace::ShutdownTypeReboot); - break; - } - return true; -} - -} // namespace Homerun - -#include "moc_powermodel.cpp" diff --git a/plasma/applets/homerun/components/sources/power/powermodel.h b/plasma/applets/homerun/components/sources/power/powermodel.h deleted file mode 100644 index 85cdad72..00000000 --- a/plasma/applets/homerun/components/sources/power/powermodel.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - Copyright 2012 Aurélien Gâteau - Copyright 2012 (C) Shaun Reich - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef POWERMODEL_H -#define POWERMODEL_H - -// Local -#include - -namespace Homerun { - -class PowerModel : public StandardItemModel -{ - Q_OBJECT - -public: - PowerModel(QObject *parent = 0); - bool trigger(int row, const QString &/*actionId*/, const QVariant &/*actionArgument*/) override; -}; - -} // namespace Homerun - -#endif diff --git a/plasma/applets/homerun/components/sources/recentapps/recentappsmodel.cpp b/plasma/applets/homerun/components/sources/recentapps/recentappsmodel.cpp deleted file mode 100644 index 4a26ebcd..00000000 --- a/plasma/applets/homerun/components/sources/recentapps/recentappsmodel.cpp +++ /dev/null @@ -1,305 +0,0 @@ -/* -Copyright 2013 Eike Hein - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -// Local -#include -#include -#include - -// Qt -#include - -// KDE -#include -#include - -#include -#include - -namespace Homerun { - -//- RecentAppsModel ------------------------------------------------------------ -RecentAppsModel::RecentAppsModel(const KConfigGroup &group, QObject *parent) -: QAbstractListModel(parent) -, m_configGroup(group) -, m_containment(0) -{ - QHash roles; - roles.insert(Qt::DisplayRole, "display"); - roles.insert(Qt::DecorationRole, "decoration"); - roles.insert(FavoriteIdRole, "favoriteId"); - roles.insert(HasActionListRole, "hasActionList"); - roles.insert(ActionListRole, "actionList"); - - setRoleNames(roles); - - QList apps = group.readEntry("RecentApps", QList()); - - if (apps.isEmpty()) { - addApp("systemsettings.desktop", false); - } else { - for (int i = apps.count() - 1; i >= 0; --i) { - addApp(apps.at(i), false); - } - } -} - -RecentAppsModel::~RecentAppsModel() -{ -} - -QObject *RecentAppsModel::containment() const -{ - return m_containment; -} - -void RecentAppsModel::setContainment(QObject *containment) -{ - m_containment = containment; -} - -int RecentAppsModel::count() const -{ - return m_storageIdList.count(); -} - -int RecentAppsModel::rowCount(const QModelIndex& index) const -{ - return index.isValid() ? 0 : m_storageIdList.count(); -} - -QVariant RecentAppsModel::data(const QModelIndex &index, int role) const -{ - if (!index.isValid() || index.row() >= m_storageIdList.count()) { - return QVariant(); - } - - const QString storageId = m_storageIdList.at(index.row()); - KService::Ptr service = KService::serviceByStorageId(storageId); - - if (!service) { - return QVariant(); - } - - if (role == Qt::DisplayRole) { - return service->name(); - } else if (role == Qt::DecorationRole) { - // at least show the oxygen question-mark, otherwise it looks weird blank. - return service->icon().isEmpty() ? QLatin1String("unknown") : service->icon(); - } else if (role == FavoriteIdRole) { - return QVariant(QString("app:") + storageId); - } else if (role == HasActionListRole) { - return true; - } else if (role == ActionListRole) { - QVariantList actionList; - - QVariantMap forgetAction = Homerun::ActionList::createActionItem(i18n("Forget Application"), "forget"); - actionList.append(forgetAction); - - actionList.append(Homerun::ActionList::createSeparatorActionItem()); - - if (qApp->property("HomerunViewerAdaptor").isValid()) - { - if (qApp->property("desktopContainmentId").toUInt() > 0 - && qApp->property("desktopContainmentMutable").toBool()) { - actionList << ActionList::createActionItem(i18n("Add to Desktop"), "addToDesktop"); - } - if (qApp->property("appletContainmentId").toUInt() > 0 - && qApp->property("appletContainmentMutable").toBool()) { - actionList << ActionList::createActionItem(i18n("Add to Panel"), "addToPanel"); - } - } else if (m_containment) { - Plasma::Containment *containment = static_cast(m_containment); - Plasma::Containment *desktop = containment->corona()->containmentForScreen(containment->screen()); - - if (desktop && desktop->immutability() == Plasma::Mutable) { - actionList << ActionList::createActionItem(i18n("Add to Desktop"), "addToDesktop"); - } - - if (containment->immutability() == Plasma::Mutable) { - actionList << ActionList::createActionItem(i18n("Add to Panel"), "addToPanel"); - } - - QObject* taskManager = 0; - - foreach(QObject* applet, containment->applets()) { - if (applet->metaObject()->indexOfSlot("hasLauncher(QString)") != -1) { - taskManager = applet; - } - } - - if (taskManager) { - bool hasLauncher = false; - - QMetaObject::invokeMethod(taskManager, "hasLauncher", Qt::DirectConnection, - Q_RETURN_ARG(bool, hasLauncher), Q_ARG(QString, storageId)); - - if (!hasLauncher) { - actionList << ActionList::createActionItem(i18n("Add as Launcher"), "addLauncher"); - } - } - } - - return actionList; - } - - return QVariant(); -} - -void RecentAppsModel::addApp(const QString& storageId, bool sync) -{ - int index = m_storageIdList.indexOf(storageId); - - if (index > 0) { - beginMoveRows(QModelIndex(), index, index, QModelIndex(), 0); - m_storageIdList.move(index, 0); - endMoveRows(); - } else if (index == -1) { - if (m_storageIdList.count() < 15) { - beginInsertRows(QModelIndex(), 0, 0); - m_storageIdList.prepend(storageId); - endInsertRows(); - emit countChanged(); - } else { - beginResetModel(); - m_storageIdList.prepend(storageId); - m_storageIdList.removeLast(); - endResetModel(); - } - } - - if (sync) { - m_configGroup.writeEntry("RecentApps", m_storageIdList); - m_configGroup.config()->sync(); - } -} - -bool RecentAppsModel::forgetApp(int row, bool sync) -{ - if (row >= m_storageIdList.count()) { - return false; - } - - beginRemoveRows(QModelIndex(), row, row); - m_storageIdList.removeAt(row); - endRemoveRows(); - - emit countChanged(); - - if (sync) { - m_configGroup.writeEntry("RecentApps", m_storageIdList); - m_configGroup.config()->sync(); - } - - return false; -} - -bool RecentAppsModel::trigger(int row, const QString &actionId, const QVariant &actionArgument) -{ - Q_UNUSED(actionArgument) - - if (row >= m_storageIdList.count()) { - return false; - } - - const QString storageId = m_storageIdList.at(row); - - if (!actionId.isEmpty()) { - if (actionId == "forget") { - return forgetApp(row); - } else { - QVariant adaptor = qApp->property("HomerunViewerAdaptor"); - - if (adaptor.isValid()) { - uint containmentId = (actionId == "addToDesktop") ? qApp->property("desktopContainmentId").toUInt() - : qApp->property("appletContainmentId").toUInt(); - return QMetaObject::invokeMethod(adaptor.value(), actionId.toLocal8Bit(), - Qt::DirectConnection, Q_ARG(uint, containmentId), Q_ARG(QString, storageId)); - } else if (m_containment) { - Plasma::Containment *containment = static_cast(m_containment); - KService::Ptr service = KService::serviceByStorageId(storageId); - - if (actionId == "addToDesktop" && service) { - Plasma::Containment *desktop = containment->corona()->containmentForScreen(containment->screen()); - - if (desktop) { - if (desktop->metaObject()->indexOfSlot("addUrls(KUrl::List)") != -1) { - QMetaObject::invokeMethod(desktop, "addUrls", - Qt::DirectConnection, Q_ARG(KUrl::List, KUrl::List(service->entryPath()))); - } else { - desktop->addApplet("icon", QVariantList() << service->entryPath()); - } - } - } else if (actionId == "addToPanel" && service) { - QRectF rect(containment->geometry().width() / 2, 0, 150, - containment->boundingRect().height()); - containment->addApplet("icon", QVariantList() << service->entryPath(), rect); - } else if (actionId == "addLauncher") { - QObject* taskManager = 0; - - foreach(QObject* applet, containment->applets()) { - if (applet->metaObject()->indexOfSlot("addLauncher(QString)") != -1) { - taskManager = applet; - } - } - - if (taskManager) { - QMetaObject::invokeMethod(taskManager, "addLauncher", Qt::DirectConnection, - Q_ARG(QString, storageId)); - } - } - } - } - } else { - KService::Ptr service = KService::serviceByStorageId(storageId); - - if (!service) { - return false; - } - - bool ran = KRun::run(*service, KUrl::List(), 0); - - if (ran) { - addApp(storageId); - } - - return ran; - } - - return false; -} - -QString RecentAppsModel::name() const -{ - return i18n("Recent Applications"); -} - -//- RecentAppsSource --------------------------------------------- -RecentAppsSource::RecentAppsSource(QObject *parent) -: AbstractSource(parent) -{} - -QAbstractItemModel *RecentAppsSource::createModelFromConfigGroup(const KConfigGroup &group) -{ - return new RecentAppsModel(group); -} - -} // namespace Homerun - -#include "moc_recentappsmodel.cpp" diff --git a/plasma/applets/homerun/components/sources/recentapps/recentappsmodel.h b/plasma/applets/homerun/components/sources/recentapps/recentappsmodel.h deleted file mode 100644 index 124264d5..00000000 --- a/plasma/applets/homerun/components/sources/recentapps/recentappsmodel.h +++ /dev/null @@ -1,84 +0,0 @@ -/* -Copyright 2013 Eike Hein - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -#ifndef RECENTAPPSMODEL_H -#define RECENTAPPSMODEL_H - -// Local -#include - -// Qt -#include - -// KDE -#include - -namespace Homerun { - -class RecentAppsModel : public QAbstractListModel -{ - Q_OBJECT - Q_PROPERTY(int count READ count NOTIFY countChanged) - Q_PROPERTY(QString name READ name CONSTANT) - Q_PROPERTY(QObject* containment READ containment WRITE setContainment) - - public: - enum Roles { - FavoriteIdRole = Qt::UserRole + 1, - HasActionListRole, - ActionListRole - }; - - RecentAppsModel(const KConfigGroup &group, QObject *parent = 0); - ~RecentAppsModel(); - - int rowCount(const QModelIndex &parent = QModelIndex()) const; - int count() const; - QVariant data(const QModelIndex &, int) const; - - Q_INVOKABLE void addApp(const QString &storageId, bool sync = true); - Q_INVOKABLE bool forgetApp(int row, bool sync = true); - - Q_INVOKABLE bool trigger(int row, const QString &actionId = QString(), const QVariant &actionArgument = QVariant()); - - QObject *containment() const; - void setContainment(QObject *containment); - - QString name() const; - - Q_SIGNALS: - void countChanged(); - - private: - QList m_storageIdList; - KConfigGroup m_configGroup; - - QObject *m_containment; -}; - -class RecentAppsSource : public AbstractSource -{ -public: - RecentAppsSource(QObject *parent); - QAbstractItemModel *createModelFromConfigGroup(const KConfigGroup &group); // reiml -}; - -} // namespace Homerun - -#endif diff --git a/plasma/applets/homerun/components/sources/runners/querymatchmodel.cpp b/plasma/applets/homerun/components/sources/runners/querymatchmodel.cpp deleted file mode 100644 index 78727628..00000000 --- a/plasma/applets/homerun/components/sources/runners/querymatchmodel.cpp +++ /dev/null @@ -1,194 +0,0 @@ -/* -Copyright 2013 Aurélien Gâteau - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 2 of -the License or (at your option) version 3 or any later version -accepted by the membership of KDE e.V. (or its successor approved -by the membership of KDE e.V.), which shall act as a proxy -defined in Section 14 of version 3 of the license. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ -// Self -#include - -// Local -#include - -// KDE -#include -#include -#include -#include -#include -#include - -// Qt -#include -#include - -namespace Homerun -{ - -QueryMatchModel::QueryMatchModel(QObject *parent) -: QAbstractListModel(parent) -{ - QHash roles; - roles.insert(Qt::DisplayRole, "display"); - roles.insert(Qt::DecorationRole, "decoration"); - roles.insert(FavoriteIdRole, "favoriteId"); - roles.insert(HasActionListRole, "hasActionList"); - roles.insert(ActionListRole, "actionList"); - setRoleNames(roles); -} - -int QueryMatchModel::count() const -{ - return m_matches.count(); -} - -int QueryMatchModel::rowCount(const QModelIndex& parent) const -{ - return parent.isValid() ? 0 : m_matches.count(); -} - -static QString favoriteIdFromMatch(const Plasma::QueryMatch &match) -{ - QString runnerId = match.runner()->id(); - if (runnerId == "services") { - return "app:" + match.data().toString(); - } else if (runnerId == "locations") { - KUrl url(match.data().toString()); - return "place:" + url.url(); - } else if (runnerId == "places") { - KUrl url(match.data().value()); - return "place:" + url.url(); - } else { - return QString(); - } -} - -static bool matchHasActionList(const Plasma::QueryMatch &match) -{ - // Hack to expose the protected Plasma::AbstractRunner::actions() method. - class MyRunner : public Plasma::AbstractRunner - { - public: - using Plasma::AbstractRunner::actions;; - }; - - // Would be great if we could know if a match has actions without getting - // them as getting the action list is costly. For now we can't, so pretend - // all matches from runners which have registered actions have actions. - MyRunner *runner = static_cast(match.runner()); - Q_ASSERT(runner); - return !runner->actions().isEmpty(); -} - -static QVariantList actionListFromMatch(Plasma::RunnerManager *manager, const Plasma::QueryMatch &match) -{ - Q_ASSERT(manager); - QVariantList actionList; - Q_FOREACH(QAction *action, manager->actionsForMatch(match)) { - QVariantMap item = ActionList::createActionItem(action->text(), "runnerAction", - QVariant::fromValue(action)); - item["icon"] = KIcon(action->icon()); - actionList << item; - } - return actionList; -} - -QVariant QueryMatchModel::data(const QModelIndex& index, int role) const -{ - if (index.row() < 0 || index.row() >= m_matches.count()) { - return QVariant(); - } - Plasma::QueryMatch match = m_matches.at(index.row()); - if (role == Qt::DisplayRole) { - return match.text(); - } else if (role == Qt::DecorationRole) { - return match.icon(); - } else if (role == FavoriteIdRole) { - return favoriteIdFromMatch(match); - } else if (role == HasActionListRole) { - return matchHasActionList(match); - } else if (role == ActionListRole) { - return actionListFromMatch(m_manager, match); - } - return QVariant(); -} - -bool QueryMatchModel::trigger(int row, const QString &actionId, const QVariant &actionArgument) -{ - Q_ASSERT(m_manager); - Plasma::QueryMatch match = m_matches.at(row); - if (!match.isEnabled()) { - return false; - } - if (!actionId.isEmpty()) { - QObject *obj = actionArgument.value(); - if (!obj) { - kWarning() << "actionArgument is not a QObject"; - return false; - } - QAction *action = qobject_cast(obj); - if (!action) { - kWarning() << "actionArgument is not a QAction"; - return false; - } - match.setSelectedAction(action); - } - m_manager->run(match); - return true; -} - -void QueryMatchModel::setMatches(const QList< Plasma::QueryMatch > &matches) -{ - bool fullReset = false; - int oldCount = m_matches.count(); - int newCount = matches.count(); - if (newCount > oldCount) { - // We received more matches than we had. If all common matches are the - // same, we can just append new matches instead of resetting the whole - // model - for (int row = 0; row < oldCount; ++row) { - if (!(m_matches.at(row) == matches.at(row))) { - fullReset = true; - break; - } - } - if (!fullReset) { - // Not a full reset, inserting rows - beginInsertRows(QModelIndex(), oldCount, newCount - 1); - m_matches = matches; - endInsertRows(); - emit countChanged(); - } - } else { - fullReset = true; - } - - if (fullReset) { - beginResetModel(); - m_matches = matches; - endResetModel(); - emit countChanged(); - } -} - -void QueryMatchModel::setRunnerManager(Plasma::RunnerManager *manager) -{ - m_manager = manager; -} - -} // namespace - -#include "moc_querymatchmodel.cpp" diff --git a/plasma/applets/homerun/components/sources/runners/querymatchmodel.h b/plasma/applets/homerun/components/sources/runners/querymatchmodel.h deleted file mode 100644 index 3587461a..00000000 --- a/plasma/applets/homerun/components/sources/runners/querymatchmodel.h +++ /dev/null @@ -1,84 +0,0 @@ -/* -Copyright 2013 Aurélien Gâteau - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 2 of -the License or (at your option) version 3 or any later version -accepted by the membership of KDE e.V. (or its successor approved -by the membership of KDE e.V.), which shall act as a proxy -defined in Section 14 of version 3 of the license. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ -#ifndef QUERYMATCHMODEL_H -#define QUERYMATCHMODEL_H - -// Local - -// KDE -#include - -// Qt -#include - -namespace Plasma -{ - class RunnerManager; -} - -namespace Homerun -{ - -/** - * This model exposes results from a list of Plasma::QueryMatch - */ -class QueryMatchModel : public QAbstractListModel -{ - Q_OBJECT - Q_PROPERTY(int count READ count NOTIFY countChanged) -public: - explicit QueryMatchModel(QObject *parent = 0); - - enum { - FavoriteIdRole = Qt::UserRole + 1, - HasActionListRole, - ActionListRole, - }; - - int count() const; - - int rowCount(const QModelIndex &parent) const override; - - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; - - Q_INVOKABLE bool trigger(int row, const QString &actionId, const QVariant &actionArgument); - - /** - * Sets the instance of RunnerManager which is handling the matches we show. - * A manager *must* be defined before calling setMatches(). - */ - void setRunnerManager(Plasma::RunnerManager *manager); - -public Q_SLOTS: - void setMatches(const QList &matches); - -Q_SIGNALS: - void countChanged(); - -protected: - QList m_matches; - -private: - Plasma::RunnerManager *m_manager = 0; -}; - -} // namespace - -#endif /* SINGLERUNNERMODEL_H */ diff --git a/plasma/applets/homerun/components/sources/runners/runnerconfigurationwidget.cpp b/plasma/applets/homerun/components/sources/runners/runnerconfigurationwidget.cpp deleted file mode 100644 index e8f07b40..00000000 --- a/plasma/applets/homerun/components/sources/runners/runnerconfigurationwidget.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -// Self -#include - -// KDE -#include -#include -#include -#include - -// Qt -#include - -Q_DECLARE_METATYPE(KPluginInfo) - -static const char *WHITELIST_KEY = "whitelist"; - -namespace Homerun -{ - -static QListWidgetItem *createWidgetItem(const KPluginInfo &info) -{ - QListWidgetItem *item = new QListWidgetItem(info.name()); - item->setIcon(KIcon(info.icon())); - item->setFlags(item->flags() | Qt::ItemIsUserCheckable); - item->setData(Qt::UserRole, QVariant::fromValue(info)); - return item; -} - -RunnerConfigurationWidget::RunnerConfigurationWidget(const KConfigGroup &group) -: SourceConfigurationWidget(group) -{ - setupUi(this); - m_searchLine->setListWidget(m_listWidget); - - // A runner is enabled if there is either a whitelist and it is part of it - // or if there is no whitelist and its EnabledByDefault key is true - - QStringList whiteList = group.readEntry(WHITELIST_KEY, QStringList()); - bool hasWhiteList = !whiteList.isEmpty(); - - KPluginInfo::List list = Plasma::RunnerManager::listRunnerInfo(); - Q_FOREACH(const KPluginInfo &info, list) { - QListWidgetItem *item = createWidgetItem(info); - bool selected; - if (hasWhiteList) { - selected = whiteList.contains(info.pluginName()); - } else { - selected = info.isPluginEnabledByDefault(); - } - item->setCheckState(selected ? Qt::Checked : Qt::Unchecked); - m_listWidget->addItem(item); - } - m_listWidget->sortItems(); -} - -void RunnerConfigurationWidget::save() -{ - QStringList whiteList; - bool hasChanges = false; - - // Only write a whiteList if the selected runner list is not the same as - // the list of all EnabledByDefault runners - - for (int idx = 0; idx < m_listWidget->count(); ++idx) { - QListWidgetItem *item = m_listWidget->item(idx); - KPluginInfo info = item->data(Qt::UserRole).value(); - - bool selected = item->checkState() == Qt::Checked; - if (selected != info.isPluginEnabledByDefault()) { - hasChanges = true; - } - if (selected) { - whiteList << info.pluginName(); - } - } - if (hasChanges) { - configGroup().writeEntry(WHITELIST_KEY, whiteList); - } else { - configGroup().deleteEntry(WHITELIST_KEY); - } -} - -} // namespace Homerun - -#include "moc_runnerconfigurationwidget.cpp" diff --git a/plasma/applets/homerun/components/sources/runners/runnerconfigurationwidget.h b/plasma/applets/homerun/components/sources/runners/runnerconfigurationwidget.h deleted file mode 100644 index de1c6723..00000000 --- a/plasma/applets/homerun/components/sources/runners/runnerconfigurationwidget.h +++ /dev/null @@ -1,48 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -#ifndef RUNNERCONFIGURATIONWIDGET_H -#define RUNNERCONFIGURATIONWIDGET_H - -// Local -#include -#include - -// Qt - -// KDE - -namespace Homerun -{ - -/** - * A configuration widget for the Runner source - */ -class RunnerConfigurationWidget : public SourceConfigurationWidget, private Ui_RunnerConfigurationWidget -{ - Q_OBJECT -public: - explicit RunnerConfigurationWidget(const KConfigGroup &); - - void save(); // reimp -}; - -} // namespace - -#endif /* RUNNERCONFIGURATIONWIDGET_H */ diff --git a/plasma/applets/homerun/components/sources/runners/runnerconfigurationwidget.ui b/plasma/applets/homerun/components/sources/runners/runnerconfigurationwidget.ui deleted file mode 100644 index dbe9df8b..00000000 --- a/plasma/applets/homerun/components/sources/runners/runnerconfigurationwidget.ui +++ /dev/null @@ -1,48 +0,0 @@ - - - RunnerConfigurationWidget - - - - 0 - 0 - 400 - 300 - - - - - - - Pick the runners you would like to use in this source: - - - - - - - - - - - - - - KListWidgetSearchLine - KLineEdit -
klistwidgetsearchline.h
-
- - KLineEdit - QLineEdit -
klineedit.h
-
- - KListWidget - QListWidget -
klistwidget.h
-
-
- - -
diff --git a/plasma/applets/homerun/components/sources/runners/runnermodel.cpp b/plasma/applets/homerun/components/sources/runners/runnermodel.cpp deleted file mode 100644 index eef34365..00000000 --- a/plasma/applets/homerun/components/sources/runners/runnermodel.cpp +++ /dev/null @@ -1,292 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -Based on RunnerModel class. RunnerModel class copyright: - -Copyright 2011 Aaron Seigo - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public -License as published by the Free Software Foundation; either -version 2 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public License -along with this library; see the file COPYING.LIB. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -Boston, MA 02110-1301, USA. -*/ -// Self -#include - -// Local -#include - -// KDE -#include -#include -#include -#include - -// Qt -#include -#include - -static const char *WHITELIST_KEY = "whitelist"; - -namespace Homerun { - -RunnerSubModel::RunnerSubModel(const QString &runnerId, const QString &name, Plasma::RunnerManager *manager, QObject *parent) -: QueryMatchModel(parent) -, m_runnerId(runnerId) -, m_name(name) -{ - setRunnerManager(manager); -} - -//-------------------------------------------------------------------- -RunnerModel::RunnerModel(const KConfigGroup &configGroup, QObject *parent) -: QAbstractListModel(parent) -, m_configGroup(configGroup) -, m_manager(0) -, m_startQueryTimer(new QTimer(this)) -, m_runningChangedTimeout(new QTimer(this)) -, m_running(false) -{ - m_startQueryTimer->setSingleShot(true); - m_startQueryTimer->setInterval(10); - connect(m_startQueryTimer, SIGNAL(timeout()), this, SLOT(startQuery())); - - //FIXME: HACK: some runners stay in a running but finished state, not possible to say if it's actually over - m_runningChangedTimeout->setSingleShot(true); - connect(m_runningChangedTimeout, SIGNAL(timeout()), this, SLOT(queryHasFinished())); - - QStringList lst = m_configGroup.readEntry(WHITELIST_KEY, QStringList()); - setAllowedRunners(lst); -} - -RunnerModel::~RunnerModel() -{ -} - -int RunnerModel::rowCount(const QModelIndex &parent) const -{ - if (parent.isValid()) { - return 0; - } - return m_models.count(); -} - -QVariant RunnerModel::data(const QModelIndex &index, int role) const -{ - if (index.parent().isValid()) { - return QVariant(); - } - - RunnerSubModel *model = m_models.value(index.row()); - if (!model) { - return QVariant(); - } - - if (role == Qt::DisplayRole) { - return model->name(); - } else { - return QVariant(); - } -} - -bool RunnerModel::running() const -{ - return m_running; -} - -QObject *RunnerModel::modelForRow(int row) const -{ - if (row < 0 || row >= m_models.count()) { - kWarning() << "No model for row" << row << "!"; - return 0; - } - return m_models.value(row); -} - -void RunnerModel::setAllowedRunners(const QStringList &list) -{ - QStringList existingList = m_manager ? m_manager->allowedRunners() : m_pendingRunnersList; - - if (existingList.toSet() == list.toSet()) { - return; - } - m_pendingRunnersList = list; - if (m_manager) { - loadRunners(); - } -} - -QString RunnerModel::currentQuery() const -{ - return m_manager ? m_manager->query() : QString(); -} - -void RunnerModel::scheduleQuery(const QString &query) -{ - m_pendingQuery = query; - m_startQueryTimer->start(); -} - -void RunnerModel::startQuery() -{ - if (m_pendingQuery.isEmpty()) { - clear(); - } - - if (!m_manager && m_pendingQuery.isEmpty()) { - // avoid creating a manager just so we can run nothing - return; - } - - createManager(); - /* DEBUG - kWarning() << "Start query" << m_pendingQuery << "on runners:"; - Q_FOREACH(Plasma::AbstractRunner *runner, m_manager->runners()) { - kWarning() << "-" << runner->name(); - } - */ - m_manager->launchQuery(m_pendingQuery); - emit queryChanged(); - m_running = true; - emit runningChanged(true); -} - -void RunnerModel::createManager() -{ - if (!m_manager) { - // RunnerManager must have its own config group to store instance-specific config - // (we don't want the manager from this RunnerModel to overwrite the config from another RunnerModel manager) - m_manager = new Plasma::RunnerManager(m_configGroup, this); - connect(m_manager, SIGNAL(matchesChanged(QList)), - this, SLOT(matchesChanged(QList))); - connect(m_manager, SIGNAL(queryFinished()), - this, SLOT(queryHasFinished())); - - if (!m_pendingRunnersList.isEmpty()) { - loadRunners(); - } - //connect(m_manager, SIGNAL(queryFinished()), this, SLOT(queryFinished())); - } -} - -void RunnerModel::matchesChanged(const QList &matches) -{ - // Group matches by runner - // We do not use a QMultiHash here because it keeps values in LIFO order, while we want FIFO. - QHash > matchesForRunner; - Q_FOREACH(const Plasma::QueryMatch &match, matches) { - QString runnerId = match.runner()->id(); - auto it = matchesForRunner.find(runnerId); - if (it == matchesForRunner.end()) { - it = matchesForRunner.insert(runnerId, QList()); - } - it.value().append(match); - } - - // Assign matches to existing models. If there is no match for a model, delete it. - for (int row = m_models.count() - 1; row >= 0; --row) { - RunnerSubModel *subModel = m_models.at(row); - QList matches = matchesForRunner.take(subModel->runnerId()); - if (matches.isEmpty()) { - beginRemoveRows(QModelIndex(), row, row); - m_models.removeAt(row); - delete subModel; - endRemoveRows(); - } else { - subModel->setMatches(matches); - } - } - - // At this point, matchesForRunner contains only matches for runners which - // do not have a model yet. Create new models for them. - if (!matchesForRunner.isEmpty()) { - beginInsertRows(QModelIndex(), rowCount(), rowCount() + matchesForRunner.size() - 1); - auto it = matchesForRunner.constBegin(); - auto end = matchesForRunner.constEnd(); - for (; it != end; ++it) { - QList matches = it.value(); - Q_ASSERT(!matches.isEmpty()); - QString name = matches.first().runner()->name(); - RunnerSubModel *subModel = new RunnerSubModel(it.key(), name, m_manager, this); - subModel->setMatches(matches); - m_models.append(subModel); - } - endInsertRows(); - } - - m_runningChangedTimeout->start(3000); -} - -void RunnerModel::queryHasFinished() -{ - m_running = false; - emit runningChanged(false); -} - -void RunnerModel::clear() -{ - if (m_models.isEmpty()) { - return; - } - beginResetModel(); - qDeleteAll(m_models); - m_models.clear(); - endResetModel(); -} - -void RunnerModel::loadRunners() -{ - Q_ASSERT(m_manager); - - KPluginInfo::List runners = m_manager->listRunnerInfo(); - - if (m_pendingRunnersList.count() > 0) { - KPluginInfo::List list = Plasma::RunnerManager::listRunnerInfo(); - Q_FOREACH(const KPluginInfo &info, list) { - if (m_pendingRunnersList.contains(info.pluginName())) { - m_manager->loadRunner(info.service()); - } - } - } - m_manager->setSingleMode(m_pendingRunnersList.count() == 1); - m_pendingRunnersList.clear(); -} - -Plasma::RunnerManager *RunnerModel::manager() const -{ - return m_manager; -} - -//- RunnerSource ------------------------------ -RunnerSource::RunnerSource(QObject *parent) -: AbstractSource(parent) -{} - -QAbstractItemModel *RunnerSource::createModelFromConfigGroup(const KConfigGroup &group) -{ - return new RunnerModel(group); -}; - -bool RunnerSource::isConfigurable() const -{ - return true; -} - -SourceConfigurationWidget *RunnerSource::createConfigurationWidget(const KConfigGroup &group) -{ - return new RunnerConfigurationWidget(group); -} - -} // namespace Homerun - -#include "moc_runnermodel.cpp" diff --git a/plasma/applets/homerun/components/sources/runners/runnermodel.h b/plasma/applets/homerun/components/sources/runners/runnermodel.h deleted file mode 100644 index a61cd8ab..00000000 --- a/plasma/applets/homerun/components/sources/runners/runnermodel.h +++ /dev/null @@ -1,133 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -Based on RunnerModel class. RunnerModel class copyright: - -Copyright 2011 Aaron Seigo - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public -License as published by the Free Software Foundation; either -version 2 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public License -along with this library; see the file COPYING.LIB. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -Boston, MA 02110-1301, USA. -*/ -#ifndef RUNNERMODEL_H -#define RUNNERMODEL_H - -// Local -#include -#include - -// Qt -#include -#include - -// KDE -#include -#include -#include - -class QTimer; - -namespace Plasma { -class RunnerManager; -} - -namespace Homerun { - -class RunnerModel; - -class RunnerSubModel : public QueryMatchModel -{ - Q_OBJECT - Q_PROPERTY(QString name READ name CONSTANT) -public: - RunnerSubModel(const QString &runnerId, const QString &name, Plasma::RunnerManager *manager, QObject *parent = 0); - - QString runnerId() const { return m_runnerId; } - QString name() const { return m_name; } - -private: - QString m_runnerId; - QString m_name; -}; - -/** - * - */ -class RunnerModel : public QAbstractListModel -{ - Q_OBJECT - /** - * @property string set the KRunner query - */ - Q_PROPERTY(QString query WRITE scheduleQuery READ currentQuery NOTIFY queryChanged) - - Q_PROPERTY(bool running READ running NOTIFY runningChanged) - -public: - explicit RunnerModel(const KConfigGroup &group, QObject *parent = 0); - ~RunnerModel(); - - Q_INVOKABLE QObject *modelForRow(int row) const; - - void setAllowedRunners(const QStringList &runners); - - int rowCount(const QModelIndex &parent = QModelIndex()) const; // reimp - QVariant data(const QModelIndex &, int role = Qt::DisplayRole) const; // reimp - - bool running() const; - - QString currentQuery() const; - - Plasma::RunnerManager *manager() const; - -public Q_SLOTS: - void scheduleQuery(const QString &query); - -Q_SIGNALS: - void queryChanged(); - void runningChanged(bool); - -private Q_SLOTS: - void startQuery(); - void queryHasFinished(); - void matchesChanged(const QList &matches); - -private: - void createManager(); - void loadRunners(); - void clear(); - - KConfigGroup m_configGroup; - Plasma::RunnerManager *m_manager; - QTimer *m_startQueryTimer; - QTimer *m_runningChangedTimeout; - - QList m_models; - QStringList m_pendingRunnersList; - bool m_running; - QString m_pendingQuery; -}; - -class RunnerSource : public AbstractSource -{ -public: - RunnerSource(QObject *parent); - QAbstractItemModel *createModelFromConfigGroup(const KConfigGroup &group); - SourceConfigurationWidget *createConfigurationWidget(const KConfigGroup &group); - bool isConfigurable() const; -}; - -} // namespace Homerun - -#endif /* RUNNERMODEL_H */ diff --git a/plasma/applets/homerun/components/sources/runners/singlerunnermodel.cpp b/plasma/applets/homerun/components/sources/runners/singlerunnermodel.cpp deleted file mode 100644 index 48062b01..00000000 --- a/plasma/applets/homerun/components/sources/runners/singlerunnermodel.cpp +++ /dev/null @@ -1,131 +0,0 @@ -/* -Copyright 2013 Aurélien Gâteau - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 2 of -the License or (at your option) version 3 or any later version -accepted by the membership of KDE e.V. (or its successor approved -by the membership of KDE e.V.), which shall act as a proxy -defined in Section 14 of version 3 of the license. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ -// Self -#include - -// Homerun -#include -#include - -// KDE -#include -#include -#include -#include - -// Qt -#include - -namespace Homerun -{ - -//- SingleRunnerModel ------------------------- -SingleRunnerModel::SingleRunnerModel(Plasma::RunnerManager *manager, QObject *parent) -: QueryMatchModel(parent) -, m_manager(manager) -{ - setRunnerManager(manager); - connect(m_manager, SIGNAL(matchesChanged(QList)), SLOT(setMatches(QList))); - launchQuery(QString()); -} - -void SingleRunnerModel::launchQuery(const QString &query) -{ - QString term = prepareSearchTerm(query); - m_manager->launchQuery(term, m_manager->singleModeRunnerId()); -} - -QString SingleRunnerModel::name() const -{ - return m_manager->singleModeRunner()->name(); -} - -QString SingleRunnerModel::prepareSearchTerm(const QString &term) -{ - const char *placeHolder = ":q:"; - Plasma::RunnerSyntax *syntax = m_manager->singleModeRunner()->defaultSyntax(); - QStringList queries = syntax->exampleQueries(); - Q_ASSERT(!queries.isEmpty()); - QString query = queries.first(); - return query.replace(placeHolder, term); -} - -//- SingleQueriableRunnerModel ---------------- -SingleQueriableRunnerModel::SingleQueriableRunnerModel(Plasma::RunnerManager *manager, QObject *parent) -: SingleRunnerModel(manager, parent) -{ -} - -QString SingleQueriableRunnerModel::query() const -{ - return m_query; -} - -void SingleQueriableRunnerModel::setQuery(const QString &value) -{ - if (m_query == value) { - return; - } - m_query = value; - launchQuery(m_query); - queryChanged(m_query); -} - -//- SingleRunnerSource ------------------------ -SingleRunnerSource::SingleRunnerSource(const QString &runnerId, QObject *parent) -: AbstractSource(parent) -, m_runnerId(runnerId) -{} - -QAbstractItemModel *SingleRunnerSource::createModelFromConfigGroup(const KConfigGroup &group_) -{ - KConfigGroup group(group_); - // RunnerManager must have its own config group to store instance-specific config - // (we don't want the manager from this RunnerModel to overwrite the config from another RunnerModel manager) - Plasma::RunnerManager *manager = new Plasma::RunnerManager(group, this); - manager->setAllowedRunners(QStringList() << m_runnerId); - manager->setSingleModeRunnerId(m_runnerId); - manager->setSingleMode(true); - if (!manager->singleModeRunner()) { - kWarning() << "Failed to load runner" << m_runnerId << "as a single mode runner"; - delete manager; - return 0; - } - - Plasma::RunnerSyntax *syntax = manager->singleModeRunner()->defaultSyntax(); - if (!syntax) { - kWarning() << "Runner" << m_runnerId << "advertises itself as a single mode runner but does not provide a default syntax!"; - delete manager; - return 0; - } - QStringList queries = syntax->exampleQueries(); - Q_ASSERT(!queries.isEmpty()); - QString query = queries.first(); - - if (query.contains(":q:")) { - return new SingleQueriableRunnerModel(manager); - } else { - return new SingleRunnerModel(manager); - } -}; - -} // namespace Homerun - -#include "moc_singlerunnermodel.cpp" diff --git a/plasma/applets/homerun/components/sources/runners/singlerunnermodel.h b/plasma/applets/homerun/components/sources/runners/singlerunnermodel.h deleted file mode 100644 index d1773e60..00000000 --- a/plasma/applets/homerun/components/sources/runners/singlerunnermodel.h +++ /dev/null @@ -1,87 +0,0 @@ -/* -Copyright 2013 Aurélien Gâteau - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 2 of -the License or (at your option) version 3 or any later version -accepted by the membership of KDE e.V. (or its successor approved -by the membership of KDE e.V.), which shall act as a proxy -defined in Section 14 of version 3 of the license. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ -#ifndef SINGLERUNNERMODEL_H -#define SINGLERUNNERMODEL_H - -// Local -#include -#include - -// KDE -#include - -namespace Homerun -{ - -/** - * This model exposes results from a runner with single-runner mode - */ -class SingleRunnerModel : public QueryMatchModel -{ - Q_OBJECT - Q_PROPERTY(QString name READ name CONSTANT) -public: - explicit SingleRunnerModel(Plasma::RunnerManager *manager, QObject * parent = 0); - - QString name() const; - - void launchQuery(const QString &query); - -private: - KConfigGroup m_configGroup; - Plasma::RunnerManager *m_manager; - - QString prepareSearchTerm(const QString &term); -}; - -/** - * This model is the same as SingleRunnerModel, except it exposes a "query" property. - * It is used when the Runner default syntax has a placeholder. - */ -class SingleQueriableRunnerModel : public SingleRunnerModel -{ - Q_OBJECT - Q_PROPERTY(QString query READ query WRITE setQuery NOTIFY queryChanged) -public: - explicit SingleQueriableRunnerModel(Plasma::RunnerManager *manager, QObject * parent = 0); - - QString query() const; - void setQuery(const QString &query); - -Q_SIGNALS: - void queryChanged(const QString &); - -private: - QString m_query; -}; - -class SingleRunnerSource : public AbstractSource -{ -public: - SingleRunnerSource(const QString &runnerId, QObject *parent); - QAbstractItemModel *createModelFromConfigGroup(const KConfigGroup &group) override; - -private: - QString m_runnerId; -}; - -} // namespace Homerun - -#endif /* SINGLERUNNERMODEL_H */ diff --git a/plasma/applets/homerun/components/sources/session/openedsessionsmodel.cpp b/plasma/applets/homerun/components/sources/session/openedsessionsmodel.cpp deleted file mode 100644 index 0763536c..00000000 --- a/plasma/applets/homerun/components/sources/session/openedsessionsmodel.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/* -Copyright 2013 Aurélien Gâteau - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 2 of -the License or (at your option) version 3 or any later version -accepted by the membership of KDE e.V. (or its successor approved -by the membership of KDE e.V.), which shall act as a proxy -defined in Section 14 of version 3 of the license. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ -// Self -#include - -// Local -#include - -// KDE -#include - -// Qt -#include - -namespace Homerun -{ - -class SwitchSessionItem : public StandardItem -{ -public: - SwitchSessionItem(KDisplayManager *manager, const SessEnt &session) - : m_displayManager(manager) - , m_vt(session.vt) - { - QString user, location; - KDisplayManager::sess2Str2(session, user, location); - setText(user + QString(" (Ctrl+Alt+F%1)").arg(session.vt)); - if (session.user.isEmpty() && session.session.isEmpty()) { - setIconName("preferences-system-login"); - } else { - setIconName("user-identity"); - } - } - - bool trigger(const QString &/*actionId*/, const QVariant &/*actionArgument*/) override - { - m_displayManager->lockSwitchVT(m_vt); - return true; - } - -private: - KDisplayManager *m_displayManager; - int m_vt; -}; - -OpenedSessionsModel::OpenedSessionsModel(QObject *parent) -: StandardItemModel(parent) -, m_watcher(new SessionsWatcher(this)) -{ - setName(i18n("Opened Sessions")); - connect(m_watcher, SIGNAL(sessionsChanged()), SLOT(refresh())); -} - -OpenedSessionsModel::~OpenedSessionsModel() -{ -} - -void OpenedSessionsModel::refresh() -{ - clear(); - - SessList sessions = m_watcher->sessions(); - - Q_FOREACH(const SessEnt &session, sessions) { - if (!session.vt || session.self) { - continue; - } - - appendRow(new SwitchSessionItem(&m_displayManager, session)); - } -} - -} // namespace - -#include "moc_openedsessionsmodel.cpp" diff --git a/plasma/applets/homerun/components/sources/session/openedsessionsmodel.h b/plasma/applets/homerun/components/sources/session/openedsessionsmodel.h deleted file mode 100644 index 88de6247..00000000 --- a/plasma/applets/homerun/components/sources/session/openedsessionsmodel.h +++ /dev/null @@ -1,53 +0,0 @@ -/* -Copyright 2013 Aurélien Gâteau - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 2 of -the License or (at your option) version 3 or any later version -accepted by the membership of KDE e.V. (or its successor approved -by the membership of KDE e.V.), which shall act as a proxy -defined in Section 14 of version 3 of the license. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ -#ifndef OPENEDSESSIONSMODEL_H -#define OPENEDSESSIONSMODEL_H - -// Local -#include - -// Qt - -// KDE -#include - -class SessionsWatcher; - -namespace Homerun -{ - -class OpenedSessionsModel : public StandardItemModel -{ - Q_OBJECT -public: - explicit OpenedSessionsModel(QObject *parent = 0); - ~OpenedSessionsModel(); - -private: - KDisplayManager m_displayManager; - SessionsWatcher *m_watcher; - -private Q_SLOTS: - void refresh(); -}; - -} // namespace - -#endif /* OPENEDSESSIONSMODEL_H */ diff --git a/plasma/applets/homerun/components/sources/session/sessionmodel.cpp b/plasma/applets/homerun/components/sources/session/sessionmodel.cpp deleted file mode 100644 index 317c7dd2..00000000 --- a/plasma/applets/homerun/components/sources/session/sessionmodel.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/* - Copyright 2012 Aurélien Gâteau - Copyright (C) 2012 Shaun Reich - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -// Own -#include "sessionmodel.h" - -// Local - -// KDE -#include -#include -#include - -// Qt -#include -#include -#include - -namespace Homerun { - -static void lockSession() -{ - QDBusConnection bus = QDBusConnection::sessionBus(); - QDBusInterface interface("org.freedesktop.ScreenSaver", "/ScreenSaver", "org.freedesktop.ScreenSaver", bus); - interface.asyncCall("Lock"); -} - -//- Local items ------------------------------------------------------------------- -class LockSessionItem : public StandardItem -{ -public: - LockSessionItem() - : StandardItem(i18nc("an action", "Lock"), "system-lock-screen") - { - } - - bool trigger(const QString &/*actionId*/, const QVariant &/*actionArgument*/) override - { - lockSession(); - return true; - } -}; - -class NewSessionItem : public StandardItem -{ -public: - NewSessionItem(KDisplayManager *manager) - : StandardItem(i18nc("an action", "New Session"), "system-switch-user") - , m_displayManager(manager) - { - } - - bool trigger(const QString &/*actionId*/, const QVariant &/*actionArgument*/) override - { - lockSession(); - m_displayManager->startReserve(); - return true; - } - -private: - KDisplayManager *m_displayManager; -}; - -class LogoutItem : public StandardItem -{ -public: - LogoutItem() - : StandardItem(i18nc("an action", "Logout"), "system-log-out") - {} - - bool trigger(const QString &/*actionId*/, const QVariant &/*actionArgument*/) override - { - KWorkSpace::requestShutDown(KWorkSpace::ShutdownConfirmDefault, KWorkSpace::ShutdownTypeNone); - return true; - } -}; - -SessionModel::SessionModel(QObject *parent) -: StandardItemModel(parent) -{ - setName(i18n("Session")); - - if (KAuthorized::authorizeKAction("lock_screen")) { - appendRow(new LockSessionItem); - } - - if (KAuthorized::authorizeKAction("logout") && KAuthorized::authorize("logout")) { - appendRow(new LogoutItem); - } - - if (KAuthorized::authorizeKAction("start_new_session") - && m_displayManager.isSwitchable() - && m_displayManager.numReserve() >= 0) - { - appendRow(new NewSessionItem(&m_displayManager)); - } -} - -} // namespace Homerun - -#include "moc_sessionmodel.cpp" diff --git a/plasma/applets/homerun/components/sources/session/sessionmodel.h b/plasma/applets/homerun/components/sources/session/sessionmodel.h deleted file mode 100644 index c265d5a2..00000000 --- a/plasma/applets/homerun/components/sources/session/sessionmodel.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - Copyright 2012 Aurélien Gâteau - Copyright 2012 (C) Shaun Reich - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef SESSIONMODEL_H -#define SESSIONMODEL_H - -// Local -#include - -// KDE -#include - -namespace Homerun { - -class SessionModel : public StandardItemModel -{ - Q_OBJECT -public: - SessionModel(QObject *parent = 0); - -private: - KDisplayManager m_displayManager; - void createUserItems(); -}; - -} // namespace Homerun - -#endif diff --git a/plasma/applets/homerun/components/sources/session/sessionswatcher.cpp b/plasma/applets/homerun/components/sources/session/sessionswatcher.cpp deleted file mode 100644 index 2790f33b..00000000 --- a/plasma/applets/homerun/components/sources/session/sessionswatcher.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/* -Copyright 2013 Aurélien Gâteau - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 2 of -the License or (at your option) version 3 or any later version -accepted by the membership of KDE e.V. (or its successor approved -by the membership of KDE e.V.), which shall act as a proxy -defined in Section 14 of version 3 of the license. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ -// Self -#include - -// Local - -// KDE - -// Qt -#include - -/* - * Polling sucks, but I don't know a better way given the wild jungle of - * display managers available. Let's poll only every 30 seconds to avoid - * draining batteries. - * Eventually support for being notified about session changes should be - * implemented at least for consolekit and systemd-logind - */ -static const int POLL_INTERVAL = 30 * 1000; - -SessionsWatcher::SessionsWatcher(QObject *parent) -: QObject(parent) -{ - QTimer *timer = new QTimer(this); - timer->setInterval(POLL_INTERVAL); - connect(timer, SIGNAL(timeout()), SLOT(checkSessions())); - timer->start(); - - QMetaObject::invokeMethod(this, "checkSessions", Qt::QueuedConnection); -} - -// SessEnt has no operator==() :/ -inline bool sameSession(const SessEnt &s1, const SessEnt &s2) -{ -#define CHECK_FIELD(f) if (s1.f != s2.f) { return false; } - CHECK_FIELD(display) - CHECK_FIELD(from) - CHECK_FIELD(user) - CHECK_FIELD(session) - CHECK_FIELD(vt) - CHECK_FIELD(self) - CHECK_FIELD(tty) -#undef CHECK_FIELD - return true; -} - -void SessionsWatcher::checkSessions() -{ - SessList newSessions; - m_displayManager.localSessions(newSessions); - if (m_sessions.count() != newSessions.count()) { - m_sessions = newSessions; - sessionsChanged(); - return; - } - auto oldIt = m_sessions.constBegin(), oldEnd = m_sessions.constEnd(); - auto newIt = newSessions.constBegin(); - for (; oldIt != oldEnd; ++oldIt, ++newIt) { - if (!sameSession(*oldIt, *newIt)) { - m_sessions = newSessions; - sessionsChanged(); - return; - } - } -} - -SessList SessionsWatcher::sessions() const -{ - return m_sessions; -} - - - -#include "moc_sessionswatcher.cpp" diff --git a/plasma/applets/homerun/components/sources/session/sessionswatcher.h b/plasma/applets/homerun/components/sources/session/sessionswatcher.h deleted file mode 100644 index b86c0eff..00000000 --- a/plasma/applets/homerun/components/sources/session/sessionswatcher.h +++ /dev/null @@ -1,53 +0,0 @@ -/* -Copyright 2013 Aurélien Gâteau - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 2 of -the License or (at your option) version 3 or any later version -accepted by the membership of KDE e.V. (or its successor approved -by the membership of KDE e.V.), which shall act as a proxy -defined in Section 14 of version 3 of the license. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ -#ifndef SESSIONSWATCHER_H -#define SESSIONSWATCHER_H - -// Local - -// Qt -#include - -// KDE -#include - -/** - * Watch sessions, emit a signal when a session is opened or closed - */ -class SessionsWatcher : public QObject -{ - Q_OBJECT -public: - explicit SessionsWatcher(QObject *parent = 0); - - SessList sessions() const; - -Q_SIGNALS: - void sessionsChanged(); - -private Q_SLOTS: - void checkSessions(); - -private: - KDisplayManager m_displayManager; - SessList m_sessions; -}; - -#endif /* SESSIONSWATCHER_H */ diff --git a/plasma/applets/homerun/components/standarditemmodel.cpp b/plasma/applets/homerun/components/standarditemmodel.cpp deleted file mode 100644 index db571821..00000000 --- a/plasma/applets/homerun/components/standarditemmodel.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* -Copyright 2013 Aurélien Gâteau - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 2 of -the License or (at your option) version 3 or any later version -accepted by the membership of KDE e.V. (or its successor approved -by the membership of KDE e.V.), which shall act as a proxy -defined in Section 14 of version 3 of the license. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ -// Self -#include - -// Local - -// KDE - -// Qt - -namespace Homerun -{ - -//- StandardItem ------------------------------------------------------------------ -StandardItem::StandardItem() -{ -} - -StandardItem::StandardItem(const QString& text, const QString& iconName) -: QStandardItem(text) -{ - setIconName(iconName); -} - -void StandardItem::setIconName(const QString &iconName) -{ - setData(iconName, Qt::DecorationRole); -} - -bool StandardItem::trigger(const QString &/*actionId*/, const QVariant &/*actionArgument*/) -{ - return false; -} - -//- StandardItemModel ------------------------------------------------------------- -StandardItemModel::StandardItemModel(QObject *parent) -: QStandardItemModel(parent) -{ - connect(this, SIGNAL(rowsInserted(QModelIndex,int,int)), SIGNAL(countChanged())); - connect(this, SIGNAL(rowsRemoved(QModelIndex,int,int)), SIGNAL(countChanged())); - connect(this, SIGNAL(modelReset()), SIGNAL(countChanged())); -} - -QString StandardItemModel::name() const -{ - return m_name; -} - -void StandardItemModel::setName(const QString &name) -{ - if (m_name == name) { - return; - } - m_name = name; - nameChanged(); -} - -int StandardItemModel::count() const -{ - return rowCount(QModelIndex()); -} - -bool StandardItemModel::trigger(int row, const QString &actionId, const QVariant &actionArgument) -{ - StandardItem *itm = static_cast(item(row)); - Q_ASSERT(itm); - return itm->trigger(actionId, actionArgument); -} - -} // namespace - -#include "moc_standarditemmodel.cpp" diff --git a/plasma/applets/homerun/components/standarditemmodel.h b/plasma/applets/homerun/components/standarditemmodel.h deleted file mode 100644 index 0b1e9705..00000000 --- a/plasma/applets/homerun/components/standarditemmodel.h +++ /dev/null @@ -1,79 +0,0 @@ -/* -Copyright 2013 Aurélien Gâteau - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 2 of -the License or (at your option) version 3 or any later version -accepted by the membership of KDE e.V. (or its successor approved -by the membership of KDE e.V.), which shall act as a proxy -defined in Section 14 of version 3 of the license. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ -#ifndef STANDARDITEMMODEL_H -#define STANDARDITEMMODEL_H - -// Local - -// Qt -#include - -// KDE - -namespace Homerun -{ - -/** - * An item to be used with StandardItemModel. Similar to QStandardItem, but - * more adapted to Homerun needs. - */ -class StandardItem : public QStandardItem -{ -public: - StandardItem(); - StandardItem(const QString &text, const QString &iconName); - virtual bool trigger(const QString &actionId, const QVariant &actionArgument); - void setIconName(const QString &); -}; - -/** - * A simple model to use when a source does not have many items. Similar to - * QStandardItemModel, but more adapted to Homerun needs. - * - * Important: One should always use items inheriting from StandardItem with this - * model. - */ -class StandardItemModel : public QStandardItemModel -{ - Q_OBJECT - Q_PROPERTY(QString name READ name NOTIFY nameChanged) - Q_PROPERTY(int count READ count NOTIFY countChanged) - -public: - StandardItemModel(QObject *parent = 0); - - int count() const; - QString name() const; - void setName(const QString &name); - - Q_INVOKABLE virtual bool trigger(int row, const QString &actionId, const QVariant &actionArgument); - -Q_SIGNALS: - void countChanged(); - void nameChanged(); - -private: - QString m_name; -}; - -} // namespace - - -#endif /* STANDARDITEMMODEL_H */ diff --git a/plasma/applets/homerun/components/tabmodel.cpp b/plasma/applets/homerun/components/tabmodel.cpp deleted file mode 100644 index f68c3b31..00000000 --- a/plasma/applets/homerun/components/tabmodel.cpp +++ /dev/null @@ -1,375 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -#include "tabmodel.h" - -// KDE -#include -#include -#include -#include - -// Qt -#include - -// Local -#include -#include - -using namespace Homerun; - -static const char *TAB_GROUP_PREFIX = "Tab"; - -static const char *GENERAL_GROUP = "General"; -static const char *GENERAL_TABS_KEY = "tabs"; - -class Tab -{ -public: - KConfigGroup m_group; - - QString m_name; - QString m_iconName; - SourceModel *m_sourceModel; - - Tab() - : m_sourceModel(0) - { - } - - ~Tab() - { - delete m_sourceModel; - } - - bool setName(const QString &value) - { - if (m_name == value) { - return false; - } - m_name = value; - saveName(); - m_group.sync(); - return true; - } - - bool setIconName(const QString &value) - { - if (m_iconName == value) { - return false; - } - m_iconName = value; - saveIconName(); - m_group.sync(); - return true; - } - - void saveName() - { - m_group.writeEntry("name", m_name); - } - - void saveIconName() - { - m_group.writeEntry("icon", m_iconName); - } - - void save() - { - // In case a deleted group is reused - m_group.writeEntry("deleted", false); - saveName(); - saveIconName(); - m_group.sync(); - } - - static Tab *createFromGroup(const KConfigGroup &group, TabModel *tabModel) - { - Tab *tab = new Tab; - - // (read "name" as QByteArray because i18n() wants a char* as argument) - QByteArray name = group.readEntry("name", QByteArray()); - if (!name.isEmpty()) { - // Only translate if not empty. If name is empty i18n(name) - // returns I18N_EMPTY_MESSAGE. - // Translation context must be the same as in internal/i18nconfig.cpp - tab->m_name = i18nc("Tab title", name); - } - - tab->m_group = group; - tab->m_sourceModel = new SourceModel(tabModel->sourceRegistry(), group, tabModel); - tab->m_iconName = group.readEntry("icon"); - return tab; - } - - void remove() - { - m_group.deleteGroup(); - m_group.writeEntry("deleted", true); - m_group.sync(); - } -}; - - -TabModel::TabModel(QObject *parent) -: QAbstractListModel(parent) -, m_sourceRegistry(0) -{ - QHash roles; - roles.insert(Qt::DisplayRole, "display"); - roles.insert(Qt::DecorationRole, "decoration"); - roles.insert(SourceModelRole, "sourceModel"); - - setRoleNames(roles); -} - -TabModel::~TabModel() -{ - qDeleteAll(m_tabList); -} - -QStringList TabModel::tabGroupList() const -{ - KConfigGroup group (m_config, GENERAL_GROUP); - return group.readEntry(GENERAL_TABS_KEY, QStringList()); -} - -void TabModel::setConfig(const KSharedConfig::Ptr &ptr) -{ - beginResetModel(); - m_config = ptr; - qDeleteAll(m_tabList); - m_tabList.clear(); - QStringList list = tabGroupList(); - Q_FOREACH(const QString &groupName, list) { - KConfigGroup group = m_config->group(groupName); - Tab *tab = Tab::createFromGroup(group, this); - if (tab) { - m_tabList << tab; - } - } - endResetModel(); - configFileNameChanged(m_config->name()); -} - -static void copyGroup(const KConfigGroup &dst_, const KConfigGroup &src) -{ - KConfigGroup dst = dst_; - QMap entryMap = src.entryMap(); - QSet keys = dst.keyList().toSet() | src.keyList().toSet(); - Q_FOREACH(const QString &key, keys) { - auto it = entryMap.find(key); - if (it == entryMap.end()) { - dst.deleteEntry(key); - } else { - dst.writeEntry(key, src.readEntry(key)); - } - } - - QStringList srcGroupList = src.groupList(); - Q_FOREACH(const QString &groupName, dst.groupList()) { - if (!srcGroupList.contains(groupName)) { - dst.deleteGroup(groupName); - } - } - Q_FOREACH(const QString &groupName, srcGroupList) { - copyGroup(dst.group(groupName), src.group(groupName)); - } -} - -void TabModel::resetConfig() -{ - KConfigGroup generalGroup = m_config->group(GENERAL_GROUP); - generalGroup.revertToDefault(GENERAL_TABS_KEY); - - QStringList tabs = generalGroup.readEntry(GENERAL_TABS_KEY, QStringList()); - - // FIXME: Should load all config files in cascade - QStringList fileNames = KGlobal::dirs()->findAllResources("config", m_config->name()); - KConfig systemConfig(fileNames.last()); - - Q_FOREACH(const QString &groupName, m_config->groupList()) { - if (!groupName.startsWith(TAB_GROUP_PREFIX)) { - continue; - } - if (tabs.contains(groupName)) { - copyGroup(m_config->group(groupName), systemConfig.group(groupName)); - } else { - m_config->deleteGroup(groupName); - } - } - m_config->sync(); - - setConfig(m_config); -} - -QString TabModel::configFileName() const -{ - return m_config ? m_config->name() : QString(); -} - -void TabModel::setConfigFileName(const QString &name) -{ - if (name == configFileName()) { - return; - } - setConfig(KSharedConfig::openConfig(name)); -} - -AbstractSourceRegistry *TabModel::sourceRegistry() const -{ - return m_sourceRegistry; -} - -void TabModel::setSourceRegistry(AbstractSourceRegistry *registry) -{ - if (m_sourceRegistry != registry) { - m_sourceRegistry = registry; - sourceRegistryChanged(); - } -} - -int TabModel::rowCount(const QModelIndex &parent) const -{ - if (m_config.isNull()) { - return 0; - } - if (parent.isValid()) { - return 0; - } - return m_tabList.count(); -} - -QVariant TabModel::data(const QModelIndex &index, int role) const -{ - Tab *tab = m_tabList.value(index.row()); - if (!tab) { - return QVariant(); - } - switch (role) { - case Qt::DisplayRole: - return tab->m_name; - case Qt::DecorationRole: - return tab->m_iconName; - case SourceModelRole: - return qVariantFromValue(static_cast(tab->m_sourceModel)); - default: - kWarning() << "Unhandled role" << role; - return QVariant(); - } -} - -void TabModel::setDataForRow(int row, const QByteArray &roleName, const QVariant &value) -{ - Tab *tab = m_tabList.value(row); - if (!tab) { - kWarning() << "Invalid row number" << row; - return; - } - - if (roleName == "display") { - if (!tab->setName(value.toString())) { - return; - } - } else if (roleName == "decoration") { - if (!tab->setIconName(value.toString())) { - return; - } - } else { - kWarning() << "Don't know how to handle role" << roleName; - return; - } - - QModelIndex idx = index(row, 0); - dataChanged(idx, idx); -} - -void TabModel::appendRow() -{ - QStringList list = tabGroupList(); - int lastId; - if (list.isEmpty()) { - lastId = -1; - } else { - bool ok; - lastId = list.last().mid(3).toInt(&ok); - if (!ok) { - kWarning() << "Cannot extract a valid lastId from" << list.last(); - return; - } - } - - KConfigGroup tabGroup = m_config->group(QLatin1String(TAB_GROUP_PREFIX) + QString::number(lastId + 1)); - Tab *tab = Tab::createFromGroup(tabGroup, this); - - int count = m_tabList.count(); - beginInsertRows(QModelIndex(), count, count); - m_tabList.append(tab); - endInsertRows(); - - tab->save(); - writeGeneralTabsEntry(); -} - -#define CHECK_ROW(row) \ - if (row < 0 || row >= m_tabList.count()) { \ - kWarning() << "Invalid row number" << row; \ - return; \ - } - -void TabModel::removeRow(int row) -{ - CHECK_ROW(row) - beginRemoveRows(QModelIndex(), row, row); - Tab *tab = m_tabList.takeAt(row); - Q_ASSERT(tab); - tab->remove(); - delete tab; - writeGeneralTabsEntry(); - endRemoveRows(); -} - -void TabModel::moveRow(int from, int to) -{ - CHECK_ROW(from) - CHECK_ROW(to) - if (from == to) { - kWarning() << "Cannot move row to itself"; - return; - } - // See beginMoveRows() doc for an explanation on modelTo - int modelTo = to + (to > from ? 1 : 0); - beginMoveRows(QModelIndex(), from, from, QModelIndex(), modelTo); - m_tabList.move(from, to); - writeGeneralTabsEntry(); - endMoveRows(); -} - -void TabModel::writeGeneralTabsEntry() -{ - QStringList lst; - Q_FOREACH(const Tab *tab, m_tabList) { - lst << tab->m_group.name(); - } - KConfigGroup group(m_config, GENERAL_GROUP); - group.writeEntry(GENERAL_TABS_KEY, lst); - m_config->sync(); -} - -#include "moc_tabmodel.cpp" diff --git a/plasma/applets/homerun/components/tabmodel.h b/plasma/applets/homerun/components/tabmodel.h deleted file mode 100644 index 97b705ce..00000000 --- a/plasma/applets/homerun/components/tabmodel.h +++ /dev/null @@ -1,87 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -#ifndef TABMODEL_H -#define TABMODEL_H - -#include - -#include - -namespace Homerun { -class AbstractSourceRegistry; -} -class Tab; - -/** - * A TabModel loads the definition of Homerun tabs from a configuration file - */ -class TabModel : public QAbstractListModel -{ - Q_OBJECT - Q_PROPERTY(QString configFileName READ configFileName WRITE setConfigFileName NOTIFY configFileNameChanged) - Q_PROPERTY(Homerun::AbstractSourceRegistry *sourceRegistry READ sourceRegistry WRITE setSourceRegistry NOTIFY sourceRegistryChanged) - -public: - enum { - SourceModelRole = Qt::UserRole + 1, - }; - - TabModel(QObject *parent = 0); - ~TabModel(); - - void setConfig(const KSharedConfig::Ptr &); - - QString configFileName() const; - void setConfigFileName(const QString &name); - - Homerun::AbstractSourceRegistry *sourceRegistry() const; - void setSourceRegistry(Homerun::AbstractSourceRegistry *registry); - - int rowCount(const QModelIndex &parent = QModelIndex()) const; // reimp - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; // reimp - - Q_INVOKABLE void setDataForRow(int row, const QByteArray &role, const QVariant &value); - - Q_INVOKABLE void appendRow(); - - Q_INVOKABLE void removeRow(int row); - - Q_INVOKABLE void moveRow(int from, int to); - - /** - * Reset configuration to default setup - */ - Q_INVOKABLE void resetConfig(); - -Q_SIGNALS: - void configFileNameChanged(const QString &); - void sourceRegistryChanged(); - -private: - KSharedConfig::Ptr m_config; - QList m_tabList; - Homerun::AbstractSourceRegistry *m_sourceRegistry; - - QStringList tabGroupList() const; - - void writeGeneralTabsEntry(); -}; - -#endif /* TABMODEL_H */ diff --git a/plasma/applets/homerun/config/homerunkickerrc b/plasma/applets/homerun/config/homerunkickerrc deleted file mode 100644 index 426c621e..00000000 --- a/plasma/applets/homerun/config/homerunkickerrc +++ /dev/null @@ -1,26 +0,0 @@ -[General] -tabs=Tab0 - -[Tab0] -name=Home -icon=go-home -sources=Source0,Source1,Source2,Source3,Source4,Source5 - -[Tab0][Source0] -sourceId=RecentApps - -[Tab0][Source1] -sourceId=FilterableInstalledApps - -[Tab0][Source2] -sourceId=RecentDocuments - -[Tab0][Source3] -sourceId=CombinedPowerSession - -[Tab0][Source4] -sourceId=FavoriteApps - -[Tab0][Source5] -sourceId=Runner -whitelist=bookmarks diff --git a/plasma/applets/homerun/config/homerunrc b/plasma/applets/homerun/config/homerunrc deleted file mode 100644 index d8a1a9e7..00000000 --- a/plasma/applets/homerun/config/homerunrc +++ /dev/null @@ -1,60 +0,0 @@ -[General] -tabs=Tab0,Tab1,Tab2,Tab3 - -[Tab0] -name=Home -icon=go-home -sources=Source0,Source1,Source2,Source3 - -[Tab0][Source0] -sourceId=FavoriteApps - -[Tab0][Source1] -sourceId=FavoritePlaces - -[Tab0][Source2] -sourceId=RecentDocuments - -[Tab0][Source3] -sourceId=Runner - -[Tab1] -name=Applications -icon=applications-other -sources=Source0,Source1 - -[Tab1][Source0] -#sourceId=InstalledApps -# For a grouped list of all apps -sourceId=FilterableInstalledApps - -[Tab1][Source1] -sourceId=Runner -whitelist=shell - -[Tab2] -name=Files -icon=folder-documents -sources=Source0,Source1 - -[Tab2][Source0] -sourceId=Dir -rootUrl=$HOME - -[Tab2][Source1] -sourceId=Runner -whitelist=bookmarks,youtube - -[Tab3] -name=Power -icon=system-shutdown -sources=Source0,Source1,Source2 - -[Tab3][Source0] -sourceId=Power - -[Tab3][Source1] -sourceId=Session - -[Tab3][Source2] -sourceId=OpenedSessions diff --git a/plasma/applets/homerun/data/favoriteapps.xml b/plasma/applets/homerun/data/favoriteapps.xml deleted file mode 100644 index a6dd79ab..00000000 --- a/plasma/applets/homerun/data/favoriteapps.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/plasma/applets/homerun/devdoc/helloworld/CMakeLists.txt b/plasma/applets/homerun/devdoc/helloworld/CMakeLists.txt deleted file mode 100644 index 8ade8806..00000000 --- a/plasma/applets/homerun/devdoc/helloworld/CMakeLists.txt +++ /dev/null @@ -1,33 +0,0 @@ -project(helloworld) - -# Dependencies -find_package(KDE4 REQUIRED) -include(KDE4Defaults) -find_package(Homerun REQUIRED) - -# Source -set(helloworld_SRCS - helloworld.cpp -) - -# Build -kde4_add_plugin(homerun_source_helloworld SHARED ${helloworld_SRCS}) - -include_directories( - ${HOMERUN_INCLUDES} - ${KDE4_INCLUDES} -) - -# The library name must start with "homerun_source_". The -# HOMERUN_EXPORT_SOURCE C macro expects this. -target_link_libraries(homerun_source_helloworld - ${QT_QTCORE_LIBRARY} - ${QT_QTGUI_LIBRARY} - ${QT_QTDECLARATIVE_LIBRARY} - ${KDE4_KDECORE_LIBS} - ${HOMERUN_LIBRARIES} -) - -# Install -install(TARGETS homerun_source_helloworld DESTINATION ${PLUGIN_INSTALL_DIR}) -install(FILES homerun-source-helloworld.desktop DESTINATION ${SERVICES_INSTALL_DIR}) diff --git a/plasma/applets/homerun/devdoc/helloworld/helloworld.cpp b/plasma/applets/homerun/devdoc/helloworld/helloworld.cpp deleted file mode 100644 index cec39c05..00000000 --- a/plasma/applets/homerun/devdoc/helloworld/helloworld.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -// Self -#include - -// Homerun -#include - -// KDE -#include -#include -#include - -typedef Homerun::SimpleSource HelloWorldSource; -// First argument is the library name without the "homerun_source_" prefix -// Second argument is the class name of the source -HOMERUN_EXPORT_SOURCE(helloworld, HelloWorldSource) - -HelloWorldModel::HelloWorldModel() -{ - // Create two items - QStandardItem *item; - - item = new QStandardItem; - item->setText(i18n("Hello")); - item->setData("face-smile", Qt::DecorationRole); - appendRow(item); - - item = new QStandardItem; - item->setText(i18n("World")); - item->setData("network-defaultroute", Qt::DecorationRole); - appendRow(item); -} - -bool HelloWorldModel::trigger(int row) -{ - QStandardItem *theItem = item(row); - Q_ASSERT(theItem); - kWarning() << "row clicked:" << row << "item:" << theItem->text(); - return true; -} - -QString HelloWorldModel::name() const -{ - return i18n("Hello World"); -} - -int HelloWorldModel::count() const -{ - return rowCount(QModelIndex()); -} - -#include "moc_helloworld.cpp" diff --git a/plasma/applets/homerun/devdoc/helloworld/helloworld.h b/plasma/applets/homerun/devdoc/helloworld/helloworld.h deleted file mode 100644 index b6200924..00000000 --- a/plasma/applets/homerun/devdoc/helloworld/helloworld.h +++ /dev/null @@ -1,55 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#ifndef HELLOWORLD_H -#define HELLOWORLD_H - -// Qt -#include - -/** - * This model implements the minimal interface of an Homerun model. - * - * To learn more about what can be done with an Homerun model read the - * README_MODELS.md file. - */ -class HelloWorldModel : public QStandardItemModel -{ - Q_OBJECT - Q_PROPERTY(QString name READ name CONSTANT) - Q_PROPERTY(int count READ count NOTIFY countChanged) -public: - HelloWorldModel(); - - Q_INVOKABLE bool trigger(int row); - - QString name() const; - - int count() const; - -Q_SIGNALS: - void countChanged(int); -}; - -#endif /* HELLOWORLD_H */ diff --git a/plasma/applets/homerun/devdoc/helloworld/homerun-source-helloworld.desktop b/plasma/applets/homerun/devdoc/helloworld/homerun-source-helloworld.desktop deleted file mode 100644 index bd6cf3b2..00000000 --- a/plasma/applets/homerun/devdoc/helloworld/homerun-source-helloworld.desktop +++ /dev/null @@ -1,71 +0,0 @@ -[Desktop Entry] -Name=Hello World -Name[bs]=Zdravo, svijete -Name[ca]=Hola món -Name[ca@valencia]=Hola món -Name[cs]=Hello World -Name[da]=Hej verden -Name[de]=Hallo Welt -Name[el]=Γεια σου κόσμε -Name[es]=Hola mundo -Name[et]=Tere, maailm -Name[fi]=Hei maailma -Name[fr]=Bonjour tout le monde -Name[gl]=Ola mundo -Name[hu]=Helló, világ -Name[it]=Ciao mondo -Name[ko]=Hello World -Name[lt]=Sveikas pasauli! -Name[mr]=हेल्लो वर्ल्ड -Name[nl]=Hallo wereld -Name[pa]=ਹੈਲੋ ਵਰਲਡ -Name[pl]=Witaj świecie -Name[pt]=Olá Mundo -Name[pt_BR]=Olá mundo -Name[ro]=Salut, lume -Name[ru]=Привет, мир -Name[sk]=Ahoj svet -Name[sl]=Pozdravljen svet -Name[sv]=Hello World -Name[tr]=Merhaba Dünya -Name[ug]=سالام دۇنيا -Name[uk]=Привіт, світе -Name[x-test]=xxHello Worldxx -Name[zh_CN]=Hello World -Comment=An example of Homerun Source -Comment[bs]=Primjer Homerun izvora -Comment[ca]=Un exemple de font per a Homerun -Comment[ca@valencia]=Un exemple de font per a Homerun -Comment[da]=Et eksempel på en Homerun-kilde -Comment[de]=Ein Beispiel einer Homerun-Quelle -Comment[el]=Ένα παράδειγμα πηγής του Homerun -Comment[es]=Un ejemplo de origen para Homerun -Comment[et]=Homeruni allika näide -Comment[fi]=Homerunin esimerkkilähde -Comment[fr]=Un exemple de service de Homerum -Comment[gl]=Un exemplo de fonte de Homerun -Comment[hu]=A Homerun forrás egy példája -Comment[it]=Un esempio di fonte di Homerun -Comment[ko]=Homerun 원본 코드 예제 -Comment[lt]=Homerun šaltinio pavyzyds -Comment[mr]=होमरन स्रोताचे उदाहरण -Comment[nl]=Voorbeeld van een Homerun-bron -Comment[pa]=ਹੋਮਰਨ ਸਰੋਤ ਦੀ ਉਦਾਹਰਨ -Comment[pl]=Przykład źródła Homerun -Comment[pt]=Um exemplo de código do Homerun -Comment[pt_BR]=Exemplo de código do Homerun -Comment[ro]=Exemplu de sursă Homerun -Comment[ru]=Пример источника Homerun -Comment[sk]=Príklad zdroja Homerun -Comment[sl]=Primer izvorne kode za Homerun -Comment[sv]=Ett exempel på Homerun-källor -Comment[tr]=Homerun Kaynağının bir örneği -Comment[uk]=Приклад джерела Homerun -Comment[x-test]=xxAn example of Homerun Sourcexx -Comment[zh_CN]=一个 Homerun 源的例子 -Type=Service -X-KDE-ServiceTypes=Homerun/Source -X-KDE-Library=homerun_source_helloworld - -X-KDE-PluginInfo-Name=HelloWorld -X-KDE-Homerun-APIVersion=0 diff --git a/plasma/applets/homerun/devdoc/overview.md b/plasma/applets/homerun/devdoc/overview.md deleted file mode 100644 index 98f80674..00000000 --- a/plasma/applets/homerun/devdoc/overview.md +++ /dev/null @@ -1,73 +0,0 @@ -# Forewords - -This document tries to provide a high-level overview of Homerun code. Those kind -of documents are always in danger of becoming obsolete. If you find that -something written there is unclear or looks outdated, get in touch with us so -we can improve or refresh it. - -# Developing sources - -If you want to create your own sources, make sure you build libhomerun -documentation with `make dox` and have a look at the `helloworld` dir in this dir. - -# QML side - -Main window is in main.qml - -main.qml contains a set of tabs, the content of each tab is handled by -TabContent. - -The TabContent item handles a stack of pages. Most tabs have only one page but -some sources, like the Dir source or the InstalledApps source, allow -navigation. In this case each new level of navigation is created as a new page. - -The Page item handles the content of a page. It mainly contains a ListView -whose items are made of a Column containing SourceItem and source views. - -SourceItem is the thin box which appears in configuration mode and allows -editing, reordering and removing a source. - -The model of a source usually directly provides the data to display, in which -case the ListView delegate contains only one ResultsView. Source model may -also provide sub-models, in which case the delegate will a Column which contains -one ResultsView per sub-model. - -A ResultsView is made of a grid view which contains one or more Result items. -Each Result displays one element of the ResultsView model. - -To sum up, the architecture looks like this: - -- main.qml - - TabContent - - Page - - Column - - SourceItem - - ResultsView - - Result - - ... - - ... - - ... - - Column - - SourceItem (The source associated with this item provides 2 sub-models) - - Column - - ResultsView - - Result - - ... - - ... - - ResultsView - - Result - - ... - - Column - - SourceItem - - ResultsView - - Result - - ... - - Page (Only if first page contained a browsable source) - -Column - - SourceItem - - ResultsView - - Result - - ... - - TabContent - - TabContent - - TabContent diff --git a/plasma/applets/homerun/devdoc/release_howto.md b/plasma/applets/homerun/devdoc/release_howto.md deleted file mode 100644 index cfbd15d2..00000000 --- a/plasma/applets/homerun/devdoc/release_howto.md +++ /dev/null @@ -1,76 +0,0 @@ -# Prepare source - -Check working tree is clean: - - git status - -Check code is up to date: - - git pull - -If it is a .0 release, create a branch (if $newv is $x.$y.0, $branch is homerun/$x.$y): - - git checkout -b $branch - git push -u origin $branch:$branch - -Update NEWS: - - git log --pretty=format:'- \%s (\%an)' $oldv..HEAD - -Update version number in top-level CMakeLists.txt. - -Check it still builds. - -Publish changes: - - git commit - git push - -# Pack source - -Get releaseme: - - git clone kde:releaseme - cd releaseme - -Create tarball: - - ./homerun.rb -u $svnusername --git-branch homerun/$x.$y --version $x.$y.$z - -Check it builds: - - tar xf homerun-$newv.tar.bz2 - cd homerun-$newv - mkdir build - cd build - cmake -DCMAKE_INSTALL_PREFIX=../install .. - make all - make check - make install - -Check translations have been installed. - -If ok, create $newv tag: - - git tag -a $newv - -Push: - - git push - git push --tags - -# Merge back in master - - git checkout master - git merge --no-ff homerun/$x.$y - git push - -# Publish - -Upload to download.kde.org, following instructions from: - - -Add new version number on: - - -Blog diff --git a/plasma/applets/homerun/fixes/CMakeLists.txt b/plasma/applets/homerun/fixes/CMakeLists.txt deleted file mode 100644 index d9275af0..00000000 --- a/plasma/applets/homerun/fixes/CMakeLists.txt +++ /dev/null @@ -1,26 +0,0 @@ -project(fixes) - -set(fixes_SRCS - declarativeitemcontainer.cpp - dialog.cpp - fixesplugin.cpp - toolboxtoggle.cpp -) - -add_library(fixesplugin SHARED ${fixes_SRCS}) - -target_link_libraries(fixesplugin - ${QT_QTCORE_LIBRARY} - ${QT_QTDECLARATIVE_LIBRARY} - ${KDE4_PLASMA_LIBS} - ${KDE4_KIO_LIBS} - ${KDE4_KFILE_LIBS} -) - -install(TARGETS fixesplugin DESTINATION ${IMPORTS_INSTALL_DIR}/org/kde/homerun/fixes) -install(DIRECTORY qml/ - DESTINATION ${IMPORTS_INSTALL_DIR}/org/kde/homerun/fixes - PATTERN "*.qml" - PATTERN "qmldir" - PATTERN "*.js" -) diff --git a/plasma/applets/homerun/fixes/README.md b/plasma/applets/homerun/fixes/README.md deleted file mode 100644 index 181820b7..00000000 --- a/plasma/applets/homerun/fixes/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# Intro - -This dir contains patched or backported copies of classes provided by other -projects. - -Those copies are intended to be temporary and should be removed when fixes are -upstreamed and available on all machines used to test Homerun. If a fix cannot -be upstreamed and there is no other workaround, the class should be forked and -moved to the components/ dir. - -# Current Status - -## TextField.qml (kde-runtime) - -### Keep placeholder text visible when focused and empty - - -Applied in 4.11 - -### Emit beginMoveRows() and endMoveRows() - -Need to be proposed - -## KFilePlacesModel (kdelibs) - -### Emit rowsMoved() when reordering via drag and drop, instead of remove+insert - - -Applied in 4.11 - -Files for the fixed KFilePlacesModel class are in `components/sources/favorites/`. - -## Dialog (kde-runtime) - -### Remove spurious forth-and-back-resizing in visible property setter - -Need to be proposed diff --git a/plasma/applets/homerun/fixes/declarativeitemcontainer.cpp b/plasma/applets/homerun/fixes/declarativeitemcontainer.cpp deleted file mode 100644 index abf80959..00000000 --- a/plasma/applets/homerun/fixes/declarativeitemcontainer.cpp +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Copyright 2011 Marco Martin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "declarativeitemcontainer_p.h" - -#include - -DeclarativeItemContainer::DeclarativeItemContainer(QGraphicsItem *parent) - : QGraphicsWidget(parent) -{ -} - -DeclarativeItemContainer::~DeclarativeItemContainer() -{ -} - -void DeclarativeItemContainer::setDeclarativeItem(QDeclarativeItem *item, bool reparent) -{ - if (m_declarativeItem) { - disconnect(m_declarativeItem.data(), 0, this, 0); - } - - setMinimumWidth(item->implicitWidth()); - setMinimumHeight(item->implicitHeight()); - - resize(item->width(), item->height()); - - m_declarativeItem = item; - if (reparent) { - static_cast(item)->setParentItem(this); - } - - connect(m_declarativeItem.data(), SIGNAL(widthChanged()), this, SLOT(widthChanged())); - connect(m_declarativeItem.data(), SIGNAL(heightChanged()), this, SLOT(heightChanged())); - - qreal minimumWidth = -1; - qreal minimumHeight = -1; - qreal maximumWidth = -1; - qreal maximumHeight = -1; - qreal preferredWidth = -1; - qreal preferredHeight = -1; - - - if (item->metaObject()->indexOfProperty("minimumWidth") >= 0 ) { - minimumWidth = item->property("minimumWidth").toReal(); - QObject::connect(item, SIGNAL(minimumWidthChanged()), this, SLOT(minimumWidthChanged())); - } - - if (item->metaObject()->indexOfProperty("minimumHeight") >= 0 ) { - minimumHeight = item->property("minimumHeight").toReal(); - QObject::connect(item, SIGNAL(minimumHeightChanged()), this, SLOT(minimumHeightChanged())); - } - - if (item->metaObject()->indexOfProperty("maximumWidth") >= 0 ) { - maximumWidth = item->property("maximumWidth").toReal(); - QObject::connect(item, SIGNAL(maximumWidthChanged()), this, SLOT(maximumWidthChanged())); - } - - if (item->metaObject()->indexOfProperty("maximumHeight") >= 0 ) { - maximumHeight = item->property("maximumHeight").toReal(); - QObject::connect(item, SIGNAL(maximumHeightChanged()), this, SLOT(maximumHeightChanged())); - } - - if (item->metaObject()->indexOfProperty("preferredWidth") >= 0 ) { - preferredWidth = item->property("preferredWidth").toReal(); - QObject::connect(item, SIGNAL(preferredWidthChanged()), this, SLOT(preferredWidthChanged())); - } - - if (item->metaObject()->indexOfProperty("preferredHeight") >= 0 ) { - preferredHeight = item->property("preferredHeight").toReal(); - QObject::connect(item, SIGNAL(preferredHeightChanged()), this, SLOT(preferredHeightChanged())); - } - - if (minimumWidth > 0 && minimumHeight > 0) { - setMinimumSize(minimumWidth, minimumHeight); - } else { - setMinimumSize(-1, -1); - } - - if (maximumWidth > 0 && maximumHeight > 0) { - setMaximumSize(maximumWidth, maximumHeight); - } else { - setMaximumSize(-1, -1); - } - - if (preferredWidth > 0 && preferredHeight > 0) { - setPreferredSize(preferredWidth, preferredHeight); - } else { - setPreferredSize(-1, -1); - } -} - -QDeclarativeItem *DeclarativeItemContainer::declarativeItem() const -{ - return m_declarativeItem.data(); -} - -void DeclarativeItemContainer::resizeEvent(QGraphicsSceneResizeEvent *event) -{ - if (m_declarativeItem) { - m_declarativeItem.data()->setProperty("width", event->newSize().width()); - m_declarativeItem.data()->setProperty("height", event->newSize().height()); - } -} - -void DeclarativeItemContainer::mousePressEvent(QGraphicsSceneMouseEvent *event) -{ - event->ignore(); -} - -void DeclarativeItemContainer::widthChanged() -{ - if (!m_declarativeItem) { - return; - } - - QSizeF newSize(size()); - newSize.setWidth(m_declarativeItem.data()->width()); - resize(newSize); -} - -void DeclarativeItemContainer::heightChanged() -{ - if (!m_declarativeItem) { - return; - } - - QSizeF newSize(size()); - newSize.setHeight(m_declarativeItem.data()->height()); - resize(newSize); -} - - -void DeclarativeItemContainer::minimumWidthChanged() -{ - qreal minimumWidth = m_declarativeItem.data()->property("minimumWidth").toReal(); - setMinimumWidth(minimumWidth); -} - -void DeclarativeItemContainer::minimumHeightChanged() -{ - qreal minimumHeight = m_declarativeItem.data()->property("minimumHeight").toReal(); - setMinimumHeight(minimumHeight); -} - -void DeclarativeItemContainer::maximumWidthChanged() -{ - qreal maximumWidth = m_declarativeItem.data()->property("maximumWidth").toReal(); - setMaximumWidth(maximumWidth); -} - -void DeclarativeItemContainer::maximumHeightChanged() -{ - qreal maximumHeight = m_declarativeItem.data()->property("maximumHeight").toReal(); - setMaximumHeight(maximumHeight); -} - -void DeclarativeItemContainer::preferredWidthChanged() -{ - qreal preferredWidth = m_declarativeItem.data()->property("preferredWidth").toReal(); - setPreferredWidth(preferredWidth); -} - -void DeclarativeItemContainer::preferredHeightChanged() -{ - qreal preferredHeight = m_declarativeItem.data()->property("preferredHeight").toReal(); - setPreferredHeight(preferredHeight); -} - -#include "moc_declarativeitemcontainer_p.cpp" diff --git a/plasma/applets/homerun/fixes/declarativeitemcontainer_p.h b/plasma/applets/homerun/fixes/declarativeitemcontainer_p.h deleted file mode 100644 index 53d837f0..00000000 --- a/plasma/applets/homerun/fixes/declarativeitemcontainer_p.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2011 Marco Martin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef DECLARATIVEITEMCONTAINER_P -#define DECLARATIVEITEMCONTAINER_P - -#include -#include -#include -#include - - -class DeclarativeItemContainer : public QGraphicsWidget -{ - Q_OBJECT - -public: - DeclarativeItemContainer(QGraphicsItem *parent = 0); - ~DeclarativeItemContainer(); - - void setDeclarativeItem(QDeclarativeItem *item, bool reparent = true); - QDeclarativeItem *declarativeItem() const; - -protected: - void resizeEvent(QGraphicsSceneResizeEvent *event); - void mousePressEvent(QGraphicsSceneMouseEvent *event); - -protected Q_SLOTS: - void widthChanged(); - void heightChanged(); - - void minimumWidthChanged(); - void minimumHeightChanged(); - void maximumWidthChanged(); - void maximumHeightChanged(); - void preferredWidthChanged(); - void preferredHeightChanged(); - -private: - QWeakPointer m_declarativeItem; -}; - -#endif diff --git a/plasma/applets/homerun/fixes/dialog.cpp b/plasma/applets/homerun/fixes/dialog.cpp deleted file mode 100644 index 447035dd..00000000 --- a/plasma/applets/homerun/fixes/dialog.cpp +++ /dev/null @@ -1,447 +0,0 @@ -/* - * Copyright 2011 Marco Martin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "dialog.h" -#include "declarativeitemcontainer_p.h" - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include - - -int DialogProxy::offscreenX = 0; -int DialogProxy::offscreenY = 0; - -DialogMargins::DialogMargins(Plasma::Dialog *dialog, QObject *parent) - : QObject(parent), - m_left(0), m_top(0), m_right(0), m_bottom(0), - m_dialog(dialog) -{ - checkMargins(); -} - -void DialogMargins::checkMargins() -{ - int left, top, right, bottom; - m_dialog->getContentsMargins(&left, &top, &right, &bottom); - - if (left != m_left) { - m_left = left; - emit leftChanged(); - } - if (top != m_top) { - m_top = top; - emit topChanged(); - } - if (right != m_right) { - m_right = right; - emit rightChanged(); - } - if (bottom != m_bottom) { - m_bottom = bottom; - emit bottomChanged(); - } -} - -int DialogMargins::left() const -{ - return m_left; -} - -int DialogMargins::top() const -{ - return m_top; -} - -int DialogMargins::right() const -{ - return m_right; -} - -int DialogMargins::bottom() const -{ - return m_bottom; -} - -DialogProxy::DialogProxy(QDeclarativeItem *parent) - : QDeclarativeItem(parent), - m_declarativeItemContainer(0), - m_activeWindow(false), - m_location(Plasma::Floating) -{ - m_dialog = new Plasma::Dialog(); - m_margins = new DialogMargins(m_dialog, this); - m_dialog->installEventFilter(this); - m_flags = m_dialog->windowFlags(); -} - -DialogProxy::~DialogProxy() -{ - delete m_declarativeItemContainer; - delete m_dialog; -} - -QGraphicsObject *DialogProxy::mainItem() const -{ - return m_mainItem.data(); -} - -void DialogProxy::setMainItem(QGraphicsObject *mainItem) -{ - if (m_mainItem.data() != mainItem) { - if (m_mainItem) { - m_mainItem.data()->setParent(mainItem ? mainItem->parent() : 0); - } - - m_mainItem = mainItem; - - if (mainItem) { - mainItem->setParentItem(0); - mainItem->setParent(this); - } - - //if this is called in Compenent.onCompleted we have to wait a loop the item is added to a scene - QTimer::singleShot(0, this, SLOT(syncMainItem())); - emit mainItemChanged(); - } -} - -void DialogProxy::syncMainItem() -{ - if (!m_mainItem) { - return; - } - - if (static_cast(m_dialog->graphicsWidget()) == m_mainItem.data() || - (m_declarativeItemContainer && m_declarativeItemContainer->declarativeItem() == m_mainItem.data())) { - return; - } - - //not have a scene? go up in the hyerarchy until we find something with a scene - QGraphicsScene *scene = m_mainItem.data()->scene(); - if (!scene) { - QObject *parent = m_mainItem.data(); - while ((parent = parent->parent())) { - QGraphicsObject *qo = qobject_cast(parent); - if (qo) { - scene = qo->scene(); - if (scene) { - scene->addItem(m_mainItem.data()); - break; - } - } - } - } - - if (!scene) { - return; - } - - //the parent of the qobject never changed, only the parentitem, so put it back what it was - m_mainItem.data()->setParentItem(qobject_cast(m_mainItem.data()->parent())); - - QGraphicsWidget *widget = qobject_cast(m_mainItem.data()); - if (widget) { - if (m_declarativeItemContainer) { - m_declarativeItemContainer->deleteLater(); - m_declarativeItemContainer = 0; - } - } else { - QDeclarativeItem *di = qobject_cast(m_mainItem.data()); - if (di) { - if (!m_declarativeItemContainer) { - m_declarativeItemContainer = new DeclarativeItemContainer(); - scene->addItem(m_declarativeItemContainer); - } - m_declarativeItemContainer->setDeclarativeItem(di); - widget = m_declarativeItemContainer; - } - } - m_dialog->setGraphicsWidget(widget); - - if (!qobject_cast(scene)) { - offscreenX -= 10000; - offscreenY -= 10000; - widget->setPos(offscreenX, offscreenY); - } -} - -bool DialogProxy::isVisible() const -{ - return m_dialog->isVisible(); -} - -void DialogProxy::setVisible(const bool visible) -{ - if (m_dialog->isVisible() != visible) { - const QRect workArea(KWindowSystem::workArea()); - if (!workArea.contains(m_dialog->geometry())) { - m_dialog->move(qBound(workArea.left(), m_dialog->x(), workArea.right() - m_dialog->width()), - qBound(workArea.top(), m_dialog->y(), workArea.bottom() - m_dialog->height()) - ); - } - - m_dialog->setVisible(visible); - if (visible && !m_dialog->testAttribute(Qt::WA_X11NetWmWindowTypeDock)) { - m_dialog->raise(); - } - } -} - -QPoint DialogProxy::popupPosition(QGraphicsObject *item, int alignment) -{ - QGraphicsObject *actualItem = item; - - //if no item is passed search the root item in order to figure out the view - if (!actualItem) { - actualItem = qobject_cast(parent()); - - //search the root object - while (true) { - QGraphicsObject *ancestor = qobject_cast(actualItem->parent()); - - if (ancestor) { - actualItem = ancestor; - } else { - break; - } - } - if (!actualItem) { - return QPoint(); - } - } - - //ensure the dialog has the proper size - syncMainItem(); - m_dialog->syncToGraphicsWidget(); - - Plasma::Corona *corona = qobject_cast(actualItem->scene()); - if (corona && item) { - return corona->popupPosition(actualItem, m_dialog->size(), (Qt::AlignmentFlag)alignment); - } else { - - if (!actualItem->scene()) { - return QPoint(); - } - - QList views = actualItem->scene()->views(); - - - if (views.size() < 1) { - return QPoint(); - } - - QGraphicsView *view = 0; - if (views.size() == 1) { - view = views[0]; - } else { - QGraphicsView *found = 0; - QGraphicsView *possibleFind = 0; - - foreach (QGraphicsView *v, views) { - if (v->sceneRect().intersects(actualItem->sceneBoundingRect()) || - v->sceneRect().contains(actualItem->scenePos())) { - if (v->isActiveWindow()) { - found = v; - } else { - possibleFind = v; - } - } - } - view = found ? found : possibleFind; - } - - if (!view) { - return QPoint(); - } - - //if no item was explicitly specified, align the dialog in the center of the parent view - if (!item) { - return view->geometry().center() - QPoint(m_dialog->width()/2, m_dialog->height()/2); - } - - //swap direction if necessary - if (QApplication::isRightToLeft() && alignment != Qt::AlignCenter) { - if (alignment == Qt::AlignRight) { - alignment = Qt::AlignLeft; - } else { - alignment = Qt::AlignRight; - } - } - - int xOffset = 0; - - if (alignment == Qt::AlignCenter) { - xOffset = actualItem->boundingRect().width()/2 - m_dialog->width()/2; - } else if (alignment == Qt::AlignRight) { - xOffset = actualItem->boundingRect().width() - m_dialog->width(); - } - - const QRect avail = QApplication::desktop()->availableGeometry(view); - QPoint menuPos = view->mapToGlobal(view->mapFromScene(actualItem->scenePos()+QPoint(xOffset, actualItem->boundingRect().height()))); - - if (menuPos.y() + m_dialog->height() > avail.bottom()) { - menuPos = view->mapToGlobal(view->mapFromScene(actualItem->scenePos() - QPoint(-xOffset, m_dialog->height()))); - } - return menuPos; - } -} - - -int DialogProxy::x() const -{ - return m_dialog->pos().x(); -} - -void DialogProxy::setX(int x) -{ - m_dialog->move(x, m_dialog->pos().y()); -} - -int DialogProxy::y() const -{ - return m_dialog->pos().y(); -} - -void DialogProxy::setY(int y) -{ - m_dialog->move(m_dialog->pos().x(), y); -} - -int DialogProxy::width() const -{ - return m_dialog->size().width(); -} - -int DialogProxy::height() const -{ - return m_dialog->size().height(); -} - -bool DialogProxy::isActiveWindow() const -{ - return m_activeWindow; -} - -void DialogProxy::activateWindow() -{ - m_dialog->activateWindow(); -} - -int DialogProxy::windowFlags() const -{ - return (int)m_flags; -} - -#ifndef Q_WS_WIN -qulonglong DialogProxy::windowId() const -{ - return m_dialog->winId(); -} -#endif - -void DialogProxy::setWindowFlags(const int flags) -{ - m_flags = (Qt::WindowFlags)flags; - m_dialog->setWindowFlags(Qt::FramelessWindowHint|m_flags); -} - -int DialogProxy::location() const -{ - return (int)m_location; -} - -void DialogProxy::setLocation(int location) -{ - if (m_location == location) { - return; - } - m_location = (Plasma::Location)location; - emit locationChanged(); -} - - -QObject *DialogProxy::margins() const -{ - return m_margins; -} - -bool DialogProxy::eventFilter(QObject *watched, QEvent *event) -{ - if (watched == m_dialog && event->type() == QEvent::Move) { - QMoveEvent *me = static_cast(event); - if (me->oldPos().x() != me->pos().x()) { - emit xChanged(); - } - if (me->oldPos().y() != me->pos().y()) { - emit yChanged(); - } - if ((me->oldPos().x() != me->pos().x()) || (me->oldPos().y() != me->pos().y())) { - m_margins->checkMargins(); - } - } else if (watched == m_dialog && event->type() == QEvent::Resize) { - QResizeEvent *re = static_cast(event); - if (re->oldSize().width() != re->size().width()) { - emit widthChanged(); - } - if (re->oldSize().height() != re->size().height()) { - emit heightChanged(); - } - } else if (watched == m_dialog && event->type() == QEvent::Show) { - Plasma::WindowEffects::slideWindow(m_dialog, m_location); - if (m_dialog->testAttribute(Qt::WA_X11NetWmWindowTypeDock)) { - KWindowSystem::setOnAllDesktops(m_dialog->winId(), true); - } else { - KWindowSystem::setOnAllDesktops(m_dialog->winId(), false); - } - emit visibleChanged(); - } else if (watched == m_dialog && event->type() == QEvent::Hide) { - Plasma::WindowEffects::slideWindow(m_dialog, m_location); - emit visibleChanged(); - } else if (watched == m_dialog && event->type() == QEvent::WindowActivate) { - m_activeWindow = true; - emit activeWindowChanged(); - } else if (watched == m_dialog && event->type() == QEvent::WindowDeactivate) { - m_activeWindow = false; - emit activeWindowChanged(); - } - return false; -} - -void DialogProxy::setAttribute(int attribute, bool on) -{ - m_dialog->setAttribute((Qt::WidgetAttribute)attribute, on); - - if (attribute == Qt::WA_X11NetWmWindowTypeDock) { - KWindowSystem::setOnAllDesktops(m_dialog->winId(), on); - } -} - -#include "moc_dialog.cpp" - diff --git a/plasma/applets/homerun/fixes/dialog.h b/plasma/applets/homerun/fixes/dialog.h deleted file mode 100644 index f21b0c2a..00000000 --- a/plasma/applets/homerun/fixes/dialog.h +++ /dev/null @@ -1,245 +0,0 @@ -/* - * Copyright 2011 Marco Martin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef DIALOG_PROXY_P -#define DIALOG_PROXY_P - -#include -#include -#include - -#include - -class QGraphicsObject; - -namespace Plasma -{ - class Dialog; -} - -class DeclarativeItemContainer; - -class DialogMargins : public QObject -{ - Q_OBJECT - - /** - * Width in pixels of the left margin - */ - Q_PROPERTY(int left READ left NOTIFY leftChanged) - - /** - * Height in pixels of the top margin - */ - Q_PROPERTY(int top READ top NOTIFY topChanged) - - /** - * Width in pixels of the right margin - */ - Q_PROPERTY(int right READ right NOTIFY rightChanged) - - /** - * Height in pixels of the bottom margin - */ - Q_PROPERTY(int bottom READ bottom NOTIFY bottomChanged) - -public: - DialogMargins(Plasma::Dialog *dialog, QObject *parent = 0); - - int left() const; - int top() const; - int right() const; - int bottom() const; - -Q_SIGNALS: - void leftChanged(); - void rightChanged(); - void topChanged(); - void bottomChanged(); - -protected: - void checkMargins(); - -private: - int m_left; - int m_top; - int m_right; - int m_bottom; - Plasma::Dialog *m_dialog; - friend class DialogProxy; -}; - -/** - * QML wrapper for kdelibs Plasma::Dialog - * - * Exposed as `Dialog` in QML. - */ -class DialogProxy : public QDeclarativeItem -{ - Q_OBJECT - - /** - * The main QML item that will be displayed in the Dialog - */ - Q_PROPERTY(QGraphicsObject *mainItem READ mainItem WRITE setMainItem NOTIFY mainItemChanged) - - /** - * Visibility of the Dialog window. Doesn't have anything to do with the visibility of the mainItem. - */ - Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged) - - /** - * X position of the dialog window in screen coordinates. - */ - Q_PROPERTY(int x READ x WRITE setX NOTIFY xChanged) - - /** - * X position of the dialog window in screen coordinates. - */ - Q_PROPERTY(int y READ y WRITE setY NOTIFY yChanged) - //to set the size try to force doing so from the inner item - - /** - * Read only width of the dialog window. It depends from the width of the mainItem - */ - Q_PROPERTY(int width READ width NOTIFY widthChanged) - - /** - * Read only height of the dialog window. It depends from the height of the mainItem - */ - Q_PROPERTY(int height READ height NOTIFY heightChanged) - - /** - * Window flags of the Dialog window - */ - Q_PROPERTY(int windowFlags READ windowFlags WRITE setWindowFlags) - - /** - * Margins of the dialog around the mainItem. - * @see DialogMargins - */ - Q_PROPERTY(QObject *margins READ margins CONSTANT) - - /** - * True if the dialog window is the active one in the window manager. - */ - Q_PROPERTY(bool activeWindow READ isActiveWindow NOTIFY activeWindowChanged) - - /** - * Plasma Location of the dialog window. Useful if this dialog is apopup for a panel - */ - Q_PROPERTY(int location READ location WRITE setLocation NOTIFY locationChanged) -//This won't be available on windows, but should be used only by kwin and never by applets anyways -#ifndef Q_WS_WIN - /** - * Window ID of the dialog window. - **/ - Q_PROPERTY(qulonglong windowId READ windowId CONSTANT) -#endif - -public: - enum WidgetAttribute { - WA_X11NetWmWindowTypeDock = Qt::WA_X11NetWmWindowTypeDock - }; - - DialogProxy(QDeclarativeItem *parent = 0); - ~DialogProxy(); - - QGraphicsObject *mainItem() const; - void setMainItem(QGraphicsObject *mainItem); - - bool isVisible() const; - void setVisible(const bool visible); - - int x() const; - void setX(int x); - - int y() const; - void setY(int y); - - int width() const; - int height() const; - - bool isActiveWindow() const; - - /** - * Ask the window manager to activate the window. - * The window manager may or may not accept the activiation request - */ - Q_INVOKABLE void activateWindow(); - - //FIXME: passing an int is ugly - int windowFlags() const; - void setWindowFlags(const int); - - int location() const; - void setLocation(int location); - - QObject *margins() const; - -#ifndef Q_WS_WIN - qulonglong windowId() const; -#endif - - /** - * @returns The suggested screen position for the popup - * @arg item the item the popup has to be positioned relatively to. if null, the popup will be positioned in the center of the window - * @arg alignment alignment of the popup compared to the item - */ - //FIXME: alignment should be Qt::AlignmentFlag - Q_INVOKABLE QPoint popupPosition(QGraphicsObject *item, int alignment=Qt::AlignLeft) ; - - /** - * Set a Qt.WidgetAttribute to the dialog window - * - * @arg int attribute see Qt.WidgetAttribute - * @arg bool on activate or deactivate the atrtibute - */ - //FIXME:: Qt::WidgetAttribute should be already - Q_INVOKABLE void setAttribute(int attribute, bool on); - -Q_SIGNALS: - void mainItemChanged(); - void visibleChanged(); - void xChanged(); - void yChanged(); - void widthChanged(); - void heightChanged(); - void activeWindowChanged(); - void locationChanged(); - -protected Q_SLOTS: - void syncMainItem(); - -protected: - bool eventFilter(QObject *watched, QEvent *event); - -private: - Plasma::Dialog *m_dialog; - Qt::WindowFlags m_flags; - DeclarativeItemContainer *m_declarativeItemContainer; - QWeakPointer m_mainItem; - DialogMargins *m_margins; - bool m_activeWindow; - Plasma::Location m_location; - static int offscreenX; - static int offscreenY; -}; - -#endif diff --git a/plasma/applets/homerun/fixes/fixesplugin.cpp b/plasma/applets/homerun/fixes/fixesplugin.cpp deleted file mode 100644 index 279584ec..00000000 --- a/plasma/applets/homerun/fixes/fixesplugin.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2012 Shaun Reich - * Copyright 2012 by Aurélien Gâteau - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -// Self -#include - -// Local -#include -#include - -// Qt -#include - -void FixesPlugin::registerTypes(const char *uri) -{ - qmlRegisterType(uri, 0, 1, "ToolBoxToggle"); - qmlRegisterType(uri, 0, 1, "Dialog"); -} - -#include "moc_fixesplugin.cpp" diff --git a/plasma/applets/homerun/fixes/fixesplugin.h b/plasma/applets/homerun/fixes/fixesplugin.h deleted file mode 100644 index fa606c17..00000000 --- a/plasma/applets/homerun/fixes/fixesplugin.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2012 Aurélien Gâteau - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef FIXESPLUGIN_H -#define FIXESPLUGIN_H - -#include - - -class FixesPlugin : public QDeclarativeExtensionPlugin -{ - Q_OBJECT - -public: - void registerTypes(const char *uri); -}; - -Q_EXPORT_PLUGIN2(fixesplugin, FixesPlugin) - -#endif diff --git a/plasma/applets/homerun/fixes/qml/TextField.qml b/plasma/applets/homerun/fixes/qml/TextField.qml deleted file mode 100644 index 41f604cf..00000000 --- a/plasma/applets/homerun/fixes/qml/TextField.qml +++ /dev/null @@ -1,433 +0,0 @@ -/* -* Copyright (C) 2011 by Daker Fernandes Pinheiro -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU Library General Public License as -* published by the Free Software Foundation; either version 2, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details -* -* You should have received a copy of the GNU Library General Public -* License along with this program; if not, write to the -* Free Software Foundation, Inc., -* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -import QtQuick 1.1 -import org.kde.plasma.core 0.1 as PlasmaCore -import org.kde.plasma.components 0.1 as PlasmaComponents -import "private" as Private - -/** - * A plasma theme based text field widget. - */ -FocusScope { - id: textField - - - property int selectStart - property int selectEnd - property int curPos - // Common API - /** - * Whether the text field is highlighted or not - * - * If it is true then the problematic lines will be highlighted. - * - * @warning Not implemented in Plasma components. - */ - property bool errorHighlight: false // TODO - - /** - * type:string - * - * The text displayed in when the text is empty. - * - * The default value is an empty string, meaning no placeholderText shown. - */ - property string placeholderText - - /** - * type:int - * The currently supported input method hints for the text field. - * - * The default values is Qt.ImhNone. - */ - property alias inputMethodHints: textInput.inputMethodHints - - /** - * type:font - * The font used in the text field. - * - * The default font value is the font from plasma desktop theme. - */ - property alias font: textInput.font - - /** - * type:int - * This property holds the current cursor position. - */ - property alias cursorPosition: textInput.cursorPosition - - /** - * type:bool - * This property holds if the text field can be modified by the user interaction. - * - * The default value is false. - */ - property alias readOnly: textInput.readOnly - - /** - * type:enum - * - * Specifies how the text should be displayed in the TextField. - * - * The acceptable values are: - * - TextInput.Normal: Displays the text as it is. (Default) - * - TextInput.Password: Displays asterixes instead of characters. - * - TextInput.NoEcho: Displays nothing. - * - TextInput.PasswordEchoOnEdit: Displays all but the current character - * as asterixes. - * - * The default value is TextInput.Normal - */ - property alias echoMode: textInput.echoMode - - - property alias passwordCharacter: textInput.passwordCharacter - property alias acceptableInput: textInput.acceptableInput // read-only - - /** - * type:string - * - * Allows you to set an input mask on the TextField, restricting the - * allowable text inputs. - * - * See QLineEdit::inputMask for further details, as the exact same mask - * strings are used by TextInput. - */ - property alias inputMask: textInput.inputMask - - /** - * type:QtObject - * - * Allows you to set a validator on the TextField. When a validator is set - * the TextField will only accept input which leaves the text property in - * an acceptable or intermediate state. The accepted signal will only be - * sent if the text is in an acceptable state when enter is pressed. - * - * Currently supported validators are IntValidator, DoubleValidator and - * RegExpValidator. - * - * An example of using validators is shown below, which allows input of - * integers between 11 and 31 into the text input: - * - * @code - * import QtQuick 1.0 - * TextInput { - * validator: IntValidator { bottom: 11; top: 31 } - * focus: true - * } - * @endcode - */ - property alias validator: textInput.validator - - /** - * type:string - * The text selected by the user. If no text is selected it holds an empty string. - * - * This property is read-only. - */ - property alias selectedText: textInput.selectedText - - /** - * type:int - * The cursor position after the last character in the current selection. - * - * This property is read-only. - */ - property alias selectionEnd: textInput.selectionEnd - - /** - * type:int - * The cursor position before the first character in the current selection. - * - * This property is read-only. - */ - property alias selectionStart: textInput.selectionStart - - /** - * type:string - * The text in the text field. - */ - property alias text: textInput.text - - /** - * type:int - * - * The maximum permitted length of the text in the TextField. If the text - * is too long, it is truncated at the limit. - * - * Default value is 32767. - */ - property alias maximumLength: textInput.maximumLength - - /** - * Emitted when the text input is accepted. - */ - signal accepted() - - //Plasma api - /** - * Whether the button to clear the text from TextField is visible. - */ - property bool clearButtonShown: false - - /** - * Copies the currently selected text to the system clipboard. - */ - function copy() { - textInput.copy(); - } - - /** - * Replaces the currently selected text by the contents of the system - * clipboard. - */ - function paste() { - textInput.paste(); - } - - /** - * Moves the currently selected text to the system clipboard. - */ - function cut() { - textInput.cut(); - } - - /** - * Causes the text from start to end to be selected. - * - * If either start or end is out of range, the selection is not changed. - * After calling this, selectionStart will become the lesser and - * selectionEnd will become the greater (regardless of the order passed to - * this method). - * - * @param int start Start of selection - * @param int end End of selection - */ - function select(start, end) { - textInput.select(start, end); - } - - /** - * Causes all text to be selected. - */ - function selectAll() { - textInput.selectAll(); - } - - /** - * Causes the word closest to the current cursor position to be selected. - */ - function selectWord() { - textInput.selectWord(); - } - - /** - * This function returns the character position at x pixels from the left - * of the TextField. - * - * Position 0 is before the first character, position 1 is after the first - * character but before the second, and so on until position text.length, - * which is after all characters. This means that for all x values before - * the first character this function returns 0, and for all x values after - * the last character this function returns text.length. - * - * @param int pos x-coordinate we are interested in. - * @return int the character position - */ - function positionAt(pos) { - return textInput.positionAt(pos); - } - - /** - * Returns the rectangle at the given position in the text. - * - * The x, y, and height properties correspond to the cursor that would - * describe that position. - * - * @param int pos the text position - * @param type:rectangle the cursor rectangle - */ - function positionToRectangle(pos) { - return textInput.positionToRectangle(pos); - } - - // Set active focus to it's internal textInput. - // Overriding QtQuick.Item forceActiveFocus function. - function forceActiveFocus() { - textInput.forceActiveFocus(); - } - - // Overriding QtQuick.Item activeFocus property. - property alias activeFocus: textInput.activeFocus - - // TODO: fix default size - implicitWidth: theme.defaultFont.mSize.width*12 + base.internalPadding*2 - implicitHeight: theme.defaultFont.mSize.height + base.internalPadding*2 - // TODO: needs to define if there will be specific graphics for - // disabled text fields - opacity: enabled ? 1.0 : 0.5 - - Private.TextFieldFocus { - id: hover - state: textInput.activeFocus ? "focus" : (mouseWatcher.containsMouse ? "hover" : "hidden") - anchors.fill: base - } - - PlasmaCore.FrameSvgItem { - id: base - - // TODO: see what is the correct policy for margins - anchors.fill: parent - imagePath: "widgets/lineedit" - prefix: "base" - property real internalPadding: theme.defaultFont.mSize.height*0.3 - } - - MouseArea { - id: mouseWatcher - anchors.fill: hover - hoverEnabled: true - onClicked: { - // If we don't set focus on click here then clicking between the - // line of text and the bottom or top of the widget will not focus - // it. - textInput.forceActiveFocus(); - } - } - - Text { - anchors { - left: parent.left - right: parent.right - verticalCenter: parent.verticalCenter - // + 2 to avoid getting stuck with carret when focused - leftMargin: base.margins.left + base.internalPadding + 2 - rightMargin: base.margins.right + base.internalPadding - } - text: placeholderText - visible: textInput.text == "" - // XXX: using textColor and low opacity for theming placeholderText - color: theme.buttonTextColor - opacity: 0.5 - elide: Text.ElideRight - clip: true - font.capitalization: theme.defaultFont.capitalization - font.family: theme.defaultFont.family - font.italic: theme.defaultFont.italic - font.letterSpacing: theme.defaultFont.letterSpacing - font.pointSize: theme.defaultFont.pointSize - font.strikeout: theme.defaultFont.strikeout - font.underline: theme.defaultFont.underline - font.weight: theme.defaultFont.weight - font.wordSpacing: theme.defaultFont.wordSpacing - } - - TextInput { - id: textInput - - anchors { - left: parent.left - right: parent.right - verticalCenter: parent.verticalCenter - // TODO: see what is the correct policy for margins - leftMargin: base.margins.left + base.internalPadding - rightMargin: base.margins.right + (clearButton.opacity > 0 ? clearButton.width : 0) + base.internalPadding - } - passwordCharacter: "•" - selectByMouse: true - color: theme.buttonTextColor - enabled: textField.enabled - clip: true - focus: true - onActiveFocusChanged: { - if (!textField.activeFocus) { - textInput.closeSoftwareInputPanel() - } - } - onAccepted: textField.accepted() - Keys.forwardTo: textField - MouseArea { - anchors.fill: parent - acceptedButtons: Qt.RightButton - onClicked: { - // FIXME: We're having to cache these and recreating the selection because TextInput's implementation clears the selection on focus loss; this should be re-evaluated and hopefully dropped in future versions - selectStart = textInput.selectionStart; - selectEnd = textInput.selectionEnd; - curPos = textInput.cursorPosition; - contextMenu.open(mouse.x, mouse.y); - textInput.cursorPosition = curPos; - textInput.select(selectStart,selectEnd); - } - } - } - - PlasmaComponents.ContextMenu { - id: contextMenu - visualParent: textInput - - PlasmaComponents.MenuItem { - text: qsTr("Cut") - icon: QIcon("edit-cut") - onClicked: { - cut(); - } - } - PlasmaComponents.MenuItem { - text: qsTr("Copy") - icon: QIcon("edit-copy") - onClicked: { - copy(); - } - } - PlasmaComponents.MenuItem { - text: qsTr("Paste") - icon: QIcon("edit-paste") - onClicked: { - paste(); - } - } - } - - PlasmaCore.IconItem { - id: clearButton - source: "edit-clear-locationbar-rtl" - height: Math.max(textInput.height, theme.smallIconSize) - width: height - opacity: (textInput.text != "" && clearButtonShown) ? 1 : 0 - Behavior on opacity { - NumberAnimation { - duration: 250 - easing.type: Easing.InOutQuad - } - } - anchors { - right: parent.right - rightMargin: y - verticalCenter: textInput.verticalCenter - } - MouseArea { - anchors.fill: parent - onClicked: { - textInput.text = "" - textInput.forceActiveFocus() - } - } - } -} diff --git a/plasma/applets/homerun/fixes/qml/private/TextFieldFocus.qml b/plasma/applets/homerun/fixes/qml/private/TextFieldFocus.qml deleted file mode 100644 index 3bc24ffc..00000000 --- a/plasma/applets/homerun/fixes/qml/private/TextFieldFocus.qml +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (C) 2011 by Daker Fernandes Pinheiro - * Copyright (C) 2011 by Marco Martin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -import QtQuick 1.0 -import org.kde.plasma.core 0.1 as PlasmaCore - -Item { - id: main - state: parent.state - - PlasmaCore.Svg { - id: lineEditSvg - imagePath: "widgets/lineedit" - onRepaintNeeded: { - if (lineEditSvg.hasElement("hint-focus-over-base")) { - main.z = 800 - } else { - main.z = 0 - } - } - Component.onCompleted: { - if (lineEditSvg.hasElement("hint-focus-over-base")) { - main.z = 800 - } else { - main.z = 0 - } - } - } - - PlasmaCore.FrameSvgItem { - id: hover - - anchors { - fill: parent - leftMargin: -margins.left - topMargin: -margins.top - rightMargin: -margins.right - bottomMargin: -margins.bottom - } - opacity: 0 - imagePath: "widgets/lineedit" - prefix: "hover" - } - - states: [ - State { - name: "hover" - PropertyChanges { - target: hover - opacity: 1 - prefix: "hover" - } - }, - State { - name: "focus" - PropertyChanges { - target: hover - opacity: 1 - prefix: "focus" - } - }, - State { - name: "hidden" - PropertyChanges { - target: hover - opacity: 0 - prefix: "hover" - } - } - ] - - transitions: [ - Transition { - PropertyAnimation { - properties: "opacity" - duration: 250 - easing.type: Easing.OutQuad - } - } - ] -} diff --git a/plasma/applets/homerun/fixes/qml/qmldir b/plasma/applets/homerun/fixes/qml/qmldir deleted file mode 100644 index 93ff295a..00000000 --- a/plasma/applets/homerun/fixes/qml/qmldir +++ /dev/null @@ -1,3 +0,0 @@ -plugin fixesplugin - -TextField 0.1 TextField.qml diff --git a/plasma/applets/homerun/fixes/toolboxtoggle.cpp b/plasma/applets/homerun/fixes/toolboxtoggle.cpp deleted file mode 100644 index c084ba65..00000000 --- a/plasma/applets/homerun/fixes/toolboxtoggle.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 2013 Eike Hein - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "toolboxtoggle.h" - -#include - -ToolBoxToggle::ToolBoxToggle(QObject *parent) : QObject(parent) -, m_toolBox(0) -, m_visible(true) -{ -} - -ToolBoxToggle::~ToolBoxToggle() -{ -} - -QObject* ToolBoxToggle::toolBox() const -{ - return m_toolBox; -} - -void ToolBoxToggle::setToolBox(QObject* toolBox) -{ - if (m_toolBox != toolBox) { - m_toolBox = static_cast(toolBox); - emit toolBoxChanged(); - - setVisible(!m_visible); - } -} - -bool ToolBoxToggle::visible() const -{ - return m_visible; -} - -void ToolBoxToggle::setVisible(bool visible) -{ - if (!m_toolBox) { - return; - } - - if (m_visible != visible) { - QGraphicsWidget *containment = static_cast(m_toolBox->parentItem()); - - if (!containment) { - return; - } - - m_visible = visible; - - QGraphicsWidget *childWidget = 0; - - foreach(QGraphicsItem *childItem, containment->childItems()) { - childWidget = static_cast(childItem); - - if (childWidget->inherits("InternalToolBox")) { - childWidget->setVisible(m_visible); - } - } - - emit visibleChanged(); - } -} - -#include "moc_toolboxtoggle.cpp" diff --git a/plasma/applets/homerun/fixes/toolboxtoggle.h b/plasma/applets/homerun/fixes/toolboxtoggle.h deleted file mode 100644 index 0f6184b0..00000000 --- a/plasma/applets/homerun/fixes/toolboxtoggle.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2013 Eike Hein - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef TOOLBOXTOGGLE_H -#define TOOLBOXTOGGLE_H - -#include - -class QGraphicsWidget; - -class ToolBoxToggle : public QObject -{ - Q_OBJECT - - Q_PROPERTY(QObject* toolBox READ toolBox WRITE setToolBox) - Q_PROPERTY(bool visible READ visible WRITE setVisible NOTIFY visibleChanged) - - public: - ToolBoxToggle(QObject *parent = 0); - ~ToolBoxToggle(); - - QObject *toolBox() const; - void setToolBox(QObject* toolBox); - - bool visible() const; - void setVisible(bool visible); - - Q_SIGNALS: - void toolBoxChanged(); - void visibleChanged(); - - private: - QGraphicsWidget *m_toolBox; - bool m_visible; -}; - -#endif diff --git a/plasma/applets/homerun/fullscreen/CMakeLists.txt b/plasma/applets/homerun/fullscreen/CMakeLists.txt deleted file mode 100644 index 82569d12..00000000 --- a/plasma/applets/homerun/fullscreen/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -add_subdirectory(applet) -add_subdirectory(package) -add_subdirectory(viewer) diff --git a/plasma/applets/homerun/fullscreen/applet/CMakeLists.txt b/plasma/applets/homerun/fullscreen/applet/CMakeLists.txt deleted file mode 100644 index 53b976d8..00000000 --- a/plasma/applets/homerun/fullscreen/applet/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -project(homerunlauncher) - -set(homerunlauncher_SRCS - homerunlauncher.cpp - generalconfigpage.ui - ) - -kde4_add_plugin(plasma_applet_homerunlauncher ${homerunlauncher_SRCS}) - -target_link_libraries(plasma_applet_homerunlauncher ${KDE4_PLASMA_LIBS} ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS} ) - -configure_file(plasma-applet-homerunlauncher.desktop.cmake - ${CMAKE_CURRENT_BINARY_DIR}/plasma-applet-homerunlauncher.desktop @ONLY) - -install(TARGETS plasma_applet_homerunlauncher - DESTINATION ${PLUGIN_INSTALL_DIR}) - -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/plasma-applet-homerunlauncher.desktop - DESTINATION ${SERVICES_INSTALL_DIR}) diff --git a/plasma/applets/homerun/fullscreen/applet/configkeys.h b/plasma/applets/homerun/fullscreen/applet/configkeys.h deleted file mode 100644 index c18cb549..00000000 --- a/plasma/applets/homerun/fullscreen/applet/configkeys.h +++ /dev/null @@ -1,26 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 2 of -the License or (at your option) version 3 or any later version -accepted by the membership of KDE e.V. (or its successor approved -by the membership of KDE e.V.), which shall act as a proxy -defined in Section 14 of version 3 of the license. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ -#ifndef CONFIGKEYS_H -#define CONFIGKEYS_H - -#define CFG_LAUNCHER_ICON_KEY "LauncherIcon" -#define CFG_LAUNCHER_ICON_DEFAULT "homerun" - -#endif /* CONFIGKEYS_H */ diff --git a/plasma/applets/homerun/fullscreen/applet/generalconfigpage.ui b/plasma/applets/homerun/fullscreen/applet/generalconfigpage.ui deleted file mode 100644 index db0f069c..00000000 --- a/plasma/applets/homerun/fullscreen/applet/generalconfigpage.ui +++ /dev/null @@ -1,39 +0,0 @@ - - - GeneralConfigPage - - - - 0 - 0 - 400 - 300 - - - - - - - Icon: - - - - - - - 48 - - - - - - - - KIconButton - QPushButton -
kicondialog.h
-
-
- - -
diff --git a/plasma/applets/homerun/fullscreen/applet/homerunlauncher.cpp b/plasma/applets/homerun/fullscreen/applet/homerunlauncher.cpp deleted file mode 100644 index 96587dcc..00000000 --- a/plasma/applets/homerun/fullscreen/applet/homerunlauncher.cpp +++ /dev/null @@ -1,218 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2012 by Shaun Reich * - * Copyright (C) 2013 by Eike Hein * - * Copyright 2007 Robert Knight * - * Copyright 2007 Kevin Ottens * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * - ***************************************************************************/ - -// Qt -#include -#include -#include -#include -#include -#include -#include - -// KDE -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// Local -#include -#include - -HomerunLauncher::HomerunLauncher(QObject * parent, const QVariantList & args) - : Plasma::Applet(parent, args), - m_icon(0), - m_serviceRegistered(QDBusConnection::sessionBus().interface()->isServiceRegistered("org.kde.homerunViewer")), - m_toggleWhenRegistered(false) -{ - setHasConfigurationInterface(true); - KGlobal::locale()->insertCatalog("plasma_applet_org.kde.homerun"); -} - -void HomerunLauncher::init() -{ - if (KService::serviceByStorageId("kde4-kmenuedit.desktop")) { - QAction* menueditor = new QAction(i18n("Edit Applications..."), this); - actions.append(menueditor); - connect(menueditor, SIGNAL(triggered(bool)), this, SLOT(startMenuEditor())); - } - - m_serviceWatcher = new QDBusServiceWatcher("org.kde.homerunViewer", QDBusConnection::sessionBus(), - QDBusServiceWatcher::WatchForOwnerChange, this); - connect(m_serviceWatcher, SIGNAL(serviceRegistered(QString)), this, SLOT(viewerServiceRegistered())); - connect(m_serviceWatcher, SIGNAL(serviceUnregistered(QString)), this, SLOT(viewerServiceUnregistered())); - - QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(this); - layout->setContentsMargins(0, 0, 0, 0); - - m_icon = new Plasma::IconWidget(this); - - connect(m_icon, SIGNAL(clicked()), SLOT(toggle())); - connect(this, SIGNAL(activate()), SLOT(toggle())); - - layout->addItem(m_icon); - - configChanged(); - - if (!m_serviceRegistered) { - kDebug() << "Service not registered, launching homerunviewer"; - startViewer(); - } -} - -QList HomerunLauncher::contextualActions() -{ - return actions; -} - -void HomerunLauncher::startMenuEditor() -{ - QProcess::execute("kmenuedit"); -} - -void HomerunLauncher::startViewer() -{ - KRun::runCommand("homerunviewer", 0); -} - -void HomerunLauncher::toggle() -{ - if (!m_serviceRegistered) { - m_toggleWhenRegistered = true; - startViewer(); - return; - } - - uint appletContainmentId = 0; - bool appletContainmentMutable = false; - uint desktopContainmentId = 0; - bool desktopContainmentMutable = false; - - if (containment()) { - if (containment()->containmentType() == Plasma::Containment::PanelContainment - || containment()->containmentType() == Plasma::Containment::CustomPanelContainment) { - appletContainmentId = containment()->id(); - } - appletContainmentMutable = containment()->immutability() == Plasma::Mutable; - - Plasma::Containment *desktop = containment()->corona()->containmentForScreen(containment()->screen()); - - if (desktop) { - desktopContainmentId = desktop->id(); - desktopContainmentMutable = desktop->immutability() == Plasma::Mutable; - } - } - - QDBusConnection bus = QDBusConnection::sessionBus(); - QDBusInterface interface("org.kde.homerunViewer", "/HomerunViewer", "org.kde.homerunViewer", bus); - interface.asyncCall("toggle", containment()->screen(), appletContainmentId, appletContainmentMutable, - desktopContainmentId, desktopContainmentMutable); -} - -void HomerunLauncher::createConfigurationInterface(KConfigDialog *parent) -{ - QWidget *widget = new QWidget; - m_generalUi.setupUi(widget); - connect(parent, SIGNAL(applyClicked()), this, SLOT(configAccepted())); - connect(parent, SIGNAL(okClicked()), this, SLOT(configAccepted())); - parent->addPage(widget, i18n("General"), "homerun"); - - m_generalUi.iconButton->setIcon(m_icon->icon()); - - connect(m_generalUi.iconButton, SIGNAL(iconChanged(QString)), parent, SLOT(settingsModified())); -} - -void HomerunLauncher::configChanged() -{ - m_icon->setIcon(config().readEntry(CFG_LAUNCHER_ICON_KEY, CFG_LAUNCHER_ICON_DEFAULT)); -} - -void HomerunLauncher::configAccepted() -{ - KConfigGroup cg = config(); - - cg.writeEntry(CFG_LAUNCHER_ICON_KEY, m_generalUi.iconButton->icon()); - - emit configNeedsSaving(); -} - -void HomerunLauncher::viewerServiceRegistered() -{ - m_serviceRegistered = true; - - if (m_toggleWhenRegistered) { - toggle(); - m_toggleWhenRegistered = false; - } - - QDBusConnection::sessionBus().connect("org.kde.homerunViewer", "/HomerunViewer", - "org.kde.homerunViewer", "addToDesktop", this, SLOT(addToDesktop(uint,QString))); - QDBusConnection::sessionBus().connect("org.kde.homerunViewer", "/HomerunViewer", - "org.kde.homerunViewer", "addToPanel", this, SLOT(addToPanel(uint,QString))); -} - -void HomerunLauncher::viewerServiceUnregistered() -{ - m_serviceRegistered = false; - - QDBusConnection::sessionBus().disconnect("org.kde.homerunViewer", "/HomerunViewer", - "org.kde.homerunViewer", "addToDesktop", this, SLOT(addToDesktop(uint,QString))); - QDBusConnection::sessionBus().disconnect("org.kde.homerunViewer", "/HomerunViewer", - "org.kde.homerunViewer", "addToPanel", this, SLOT(addToPanel(uint,QString))); -} - -void HomerunLauncher::addToDesktop(uint containmentId, const QString &storageId) -{ - Plasma::Containment *desktop = containment()->corona()->containmentForScreen(containment()->screen()); - KService::Ptr service = KService::serviceByStorageId(storageId); - - if (!desktop || !service || desktop->id() != containmentId) { - return; - } - - if (desktop->metaObject()->indexOfSlot("addUrls(KUrl::List)") != -1) { - QMetaObject::invokeMethod(desktop, "addUrls", - Qt::DirectConnection, Q_ARG(KUrl::List, KUrl::List(service->entryPath()))); - } else { - desktop->addApplet("icon", QVariantList() << service->entryPath()); - } -} - -void HomerunLauncher::addToPanel(uint containmentId, const QString &storageId) -{ - KService::Ptr service = KService::serviceByStorageId(storageId); - - if (service || containment()->id() == containmentId) { - // move it to the middle of the panel - QRectF rect(containment()->geometry().width() / 3, 0, 150, containment()->boundingRect().height()); - containment()->addApplet("icon", QVariantList() << service->entryPath(), rect); - } - -} - -#include "moc_homerunlauncher.cpp" diff --git a/plasma/applets/homerun/fullscreen/applet/homerunlauncher.h b/plasma/applets/homerun/fullscreen/applet/homerunlauncher.h deleted file mode 100644 index d7a75d40..00000000 --- a/plasma/applets/homerun/fullscreen/applet/homerunlauncher.h +++ /dev/null @@ -1,74 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2012 by Shaun Reich * - * Copyright (C) 2013 by Eike Hein * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * - ***************************************************************************/ - -#ifndef HOMERUNLAUNCHER_H -#define HOMERUNLAUNCHER_H - -// KDE -#include - -// Local -#include - -namespace Plasma { - class IconWidget; -} - -class QDBusServiceWatcher; -class QGraphicsSceneMouseEvent; -class QSizeF; - -class HomerunLauncher : public Plasma::Applet -{ - Q_OBJECT -public: - HomerunLauncher(QObject * parent, const QVariantList & args); - - void init(); - - void createConfigurationInterface(KConfigDialog *parent); // reimp - - QList contextualActions(); - - public slots: - void configChanged(); - -private Q_SLOTS: - void toggle(); - void configAccepted(); - void startMenuEditor(); - void viewerServiceRegistered(); - void viewerServiceUnregistered(); - void addToDesktop(uint containmentId, const QString &storageId); - void addToPanel(uint containmentId, const QString &storageId); - -private: - Plasma::IconWidget *m_icon; - QDBusServiceWatcher *m_serviceWatcher; - bool m_serviceRegistered; - bool m_toggleWhenRegistered; - QList actions; - Ui_GeneralConfigPage m_generalUi; - - void startViewer(); -}; - -K_EXPORT_PLASMA_APPLET (homerunlauncher, HomerunLauncher) -#endif diff --git a/plasma/applets/homerun/fullscreen/applet/plasma-applet-homerunlauncher.desktop.cmake b/plasma/applets/homerun/fullscreen/applet/plasma-applet-homerunlauncher.desktop.cmake deleted file mode 100644 index a192a0d1..00000000 --- a/plasma/applets/homerun/fullscreen/applet/plasma-applet-homerunlauncher.desktop.cmake +++ /dev/null @@ -1,81 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -# ctxt: "Homerun" is a product name -Name=Homerun Launcher -Name[bs]=Homerun pokretač -Name[ca]=Llançador Homerun -Name[ca@valencia]=Llançador Homerun -Name[cs]=Spouštěč Homerun -Name[da]=Startmenuen Homerun -Name[de]=Homerun-Starter -Name[el]=Εκτελεστής Homerun -Name[es]=Lanzador Homerun -Name[fi]=Homerun-käynnistin -Name[fr]=Lanceur de Homerun -Name[gl]=Lanzador Homerun -Name[hu]=Homerun indító -Name[it]=Avviatore di Homerun -Name[ko]=Homerun 실행기 -Name[nl]=Programmastarter Homerun -Name[pl]=Program uruchamiający Homerun -Name[pt]=Lançador Homerun -Name[pt_BR]=Lançador Homerun -Name[ro]=Lansator Homerun -Name[ru]=Запуск Homerun -Name[sk]=Spúšťač Homerun -Name[sl]=Zaganjalnik Homerun -Name[sv]=Homerun startprogram -Name[tr]=Homerun Çalıştırıcı -Name[uk]=Засіб запуску Homerun -Name[x-test]=xxHomerun Launcherxx -Name[zh_CN]=Homerun 启动器 - -Comment=An application launcher -Comment[bs]=Pokretač aplikacija -Comment[ca]=Un llançador d'aplicacions -Comment[ca@valencia]=Un llançador d'aplicacions -Comment[cs]=Spouštěč aplikací -Comment[da]=Programstarter -Comment[de]=Ein Anwendungsstarter -Comment[el]=Ένας εκτελεστής εφαρμογών -Comment[es]=Un lanzador de aplicaciones -Comment[et]=Rakenduste käivitaja -Comment[fi]=Sovelluskäynnistin -Comment[fr]=Un lanceur d'applications -Comment[gl]=Un lanzador de programas. -Comment[hu]=Egy alkalmazásindító -Comment[it]=Un avviatore di applicazioni -Comment[ko]=프로그램 실행기 -Comment[lt]=Programų leidiklis -Comment[mr]=अनुप्रयोग प्रक्षेपक -Comment[nl]=Een programmastarter -Comment[pa]=ਐਪਲੀਕੇਸ਼ਨ ਲਾਂਚਰ -Comment[pl]=Program uruchamiający -Comment[pt]=Um lançador de aplicações -Comment[pt_BR]=Um lançador de aplicativos -Comment[ro]=Lansator de aplicații -Comment[ru]=Запуск приложения -Comment[sk]=Spúšťač aplikácií -Comment[sl]=Zaganjalnik programov -Comment[sv]=Ett startprogram -Comment[tr]=Bir uygulama çalıştırıcı -Comment[uk]=Засіб для запуску програм -Comment[x-test]=xxAn application launcherxx -Comment[zh_CN]=一个应用程序启动器 - -Type=Service -ServiceTypes=Plasma/Applet -Icon=homerun - -X-KDE-Library=plasma_applet_homerunlauncher -X-KDE-PluginInfo-Author=Homerun Developers -X-KDE-PluginInfo-Name=homerunlauncher -X-KDE-PluginInfo-Version=@HOMERUN_VERSION@ -X-KDE-PluginInfo-Website=http://userbase.kde.org/Homerun -X-KDE-PluginInfo-Category=Application Launchers -X-KDE-PluginInfo-Depends= -X-KDE-PluginInfo-License=GPL -X-KDE-PluginInfo-EnabledByDefault=true - -X-Plasma-Requires-FileDialog=Unused -X-Plasma-Requires-LaunchApp=Unused diff --git a/plasma/applets/homerun/fullscreen/package/CMakeLists.txt b/plasma/applets/homerun/fullscreen/package/CMakeLists.txt deleted file mode 100644 index 7ff5695b..00000000 --- a/plasma/applets/homerun/fullscreen/package/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -set(homerun_plasmoid_dir ${DATA_INSTALL_DIR}/plasma/plasmoids/org.kde.homerun) -set(metadata_dot_desktop ${CMAKE_CURRENT_BINARY_DIR}/metadata.desktop) - -configure_file(metadata.desktop.cmake - ${metadata_dot_desktop} @ONLY) - -install(DIRECTORY contents - DESTINATION ${homerun_plasmoid_dir}) - -install(FILES ${metadata_dot_desktop} - DESTINATION ${homerun_plasmoid_dir}) - -install(FILES ${metadata_dot_desktop} - DESTINATION ${SERVICES_INSTALL_DIR} RENAME plasma-applet-homerun.desktop) diff --git a/plasma/applets/homerun/fullscreen/package/contents/config/main.xml b/plasma/applets/homerun/fullscreen/package/contents/config/main.xml deleted file mode 100644 index 684b6ceb..00000000 --- a/plasma/applets/homerun/fullscreen/package/contents/config/main.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - #222 - - - false - - - true - - - false - - - white - - - diff --git a/plasma/applets/homerun/fullscreen/package/contents/ui/AvailableSourceItem.qml b/plasma/applets/homerun/fullscreen/package/contents/ui/AvailableSourceItem.qml deleted file mode 100644 index 2ce3b1d7..00000000 --- a/plasma/applets/homerun/fullscreen/package/contents/ui/AvailableSourceItem.qml +++ /dev/null @@ -1,76 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -import QtQuick 1.1 -import org.kde.plasma.components 0.1 as PlasmaComponents -import org.kde.plasma.core 0.1 as PlasmaCore - -Item { - id: main - property alias text: textLabel.text - property alias comment: commentLabel.text - - signal clicked - - height: frame.height - - PlasmaCore.FrameSvgItem { - id: frame - imagePath: "widgets/background" - width: parent.width - height: commentLabel.y + commentLabel.height + margins.bottom - - PlasmaComponents.Label { - id: textLabel - anchors { - verticalCenter: addButton.verticalCenter - left: parent.left - leftMargin: frame.margins.left - right: addButton.left - } - font.weight: Font.Bold - elide: Text.ElideRight - } - - PlasmaComponents.ToolButton { - id: addButton - anchors { - top: parent.top - topMargin: frame.margins.top - right: parent.right - rightMargin: frame.margins.right - } - flat: false - iconSource: "list-add" - onClicked: main.clicked() - } - - PlasmaComponents.Label { - id: commentLabel - anchors { - left: parent.left - leftMargin: frame.margins.left - right: parent.right - rightMargin: frame.margins.right - top: addButton.bottom - } - wrapMode: Text.Wrap - } - } -} diff --git a/plasma/applets/homerun/fullscreen/package/contents/ui/DebugRectangle.qml b/plasma/applets/homerun/fullscreen/package/contents/ui/DebugRectangle.qml deleted file mode 100644 index c4921048..00000000 --- a/plasma/applets/homerun/fullscreen/package/contents/ui/DebugRectangle.qml +++ /dev/null @@ -1,30 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -import QtQuick 1.1 - -/** - * Handy rectangle which fits its parent and tint it. - * Useful to debug item boundaries. - */ -Rectangle { - anchors.fill: parent - color: "red" - opacity: 0.3 -} diff --git a/plasma/applets/homerun/fullscreen/package/contents/ui/LogText.qml b/plasma/applets/homerun/fullscreen/package/contents/ui/LogText.qml deleted file mode 100644 index 7ccae50b..00000000 --- a/plasma/applets/homerun/fullscreen/package/contents/ui/LogText.qml +++ /dev/null @@ -1,32 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -import QtQuick 1.1 - -Rectangle { - property alias text: innerText.text - width: childrenRect.width + 4 - height: childrenRect.height + 4 - color: Qt.rgba(1, 1, 1, 0.6) - Text { - id: innerText - x: 2 - y: 2 - } -} \ No newline at end of file diff --git a/plasma/applets/homerun/fullscreen/package/contents/ui/MessageItem.qml b/plasma/applets/homerun/fullscreen/package/contents/ui/MessageItem.qml deleted file mode 100644 index 552f2fc0..00000000 --- a/plasma/applets/homerun/fullscreen/package/contents/ui/MessageItem.qml +++ /dev/null @@ -1,91 +0,0 @@ -/* -Copyright 2013 Aurélien Gâteau - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -import QtQuick 1.1 - -import org.kde.plasma.core 0.1 as PlasmaCore - -import org.kde.homerun.components 0.1 as HomerunComponents - -/** - * An item which is invisible by default but can show a message - * composed of a text and an icon for a few seconds. - */ -Item { - id: main - width: frame.width - height: frame.height - - opacity: 0 - Behavior on opacity { NumberAnimation {}} - - Timer { - id: timer - interval: 5000 - onTriggered: main.state = ""; - } - - PlasmaCore.FrameSvgItem { - id: frame - y: -10 - Behavior on y { NumberAnimation {}} - imagePath: "widgets/tooltip" - width: row.width + margins.left + margins.right - height: row.height + margins.top + margins.bottom - - Row { - id: row - spacing: 6 - x: frame.margins.left - y: frame.margins.top - HomerunComponents.Image { - id: icon - width: 22 - height: width - anchors.verticalCenter: parent.verticalCenter - } - HomerunComponents.Label { - id: label - anchors.verticalCenter: parent.verticalCenter - } - } - } - - states: State { - name: "visible" - PropertyChanges { - target: main - opacity: 1 - } - PropertyChanges { - target: frame - y: 0 - } - PropertyChanges { - target: timer - running: true - } - } - - function show(iconName, text) { - icon.source = iconName; - label.text = text; - state = "visible"; - } -} diff --git a/plasma/applets/homerun/fullscreen/package/contents/ui/Page.qml b/plasma/applets/homerun/fullscreen/package/contents/ui/Page.qml deleted file mode 100644 index 0668a165..00000000 --- a/plasma/applets/homerun/fullscreen/package/contents/ui/Page.qml +++ /dev/null @@ -1,726 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -import QtQuick 1.1 -import org.kde.homerun.components 0.1 as HomerunComponents -import org.kde.plasma.components 0.1 as PlasmaComponents -import org.kde.plasma.core 0.1 as PlasmaCore -import org.kde.plasma.extras 0.1 as PlasmaExtras -import org.kde.qtextracomponents 0.1 as QtExtra - -Item { - id: main - - //- Defined by outside world ----------------------------------- - property Item rootItem - property QtObject sourceRegistry - - property QtObject tabSourceModel - property bool configureMode - property bool showActionListOverlay - - property string searchCriteria - - //- Read-write properties -------------------------------------- - property bool showHeader: true - - //- Read-only properties --------------------------------------- - // Defined for pages with a single view on a browsable model - property QtObject pathModel: tabSourceModel.count == 1 ? tabSourceModel.get(0).model.pathModel : null - - signal closeRequested() - signal openSourceRequested(string sourceId, variant sourceArguments) - signal showMessageRequested(string icon, string text) - - property Item previouslyFocusedItem - - //- Components ------------------------------------------------- - // Filter components - Component { - id: genericFilterComponent - - PlasmaCore.SortFilterModel { - filterRegExp: main.searchCriteria - property string name: sourceModel.name - property int count: sourceModel.count - property bool canMoveRow: "canMoveRow" in sourceModel ? sourceModel.canMoveRow : false - property bool running: "running" in sourceModel ? sourceModel.running : false - property QtObject pathModel: "pathModel" in sourceModel ? sourceModel.pathModel : null - - objectName: "SortFilterModel:" + (sourceModel ? sourceModel.objectName : "") - - function trigger(index, actionId, actionArgument) { - var sourceIndex = mapRowToSource(index); - return sourceModel.trigger(sourceIndex, actionId, actionArgument); - } - - function moveRow(from, to) { - if (!canMoveRow) { - console.log("Page.qml: moveRow(): source model cannot move rows. This method should not be called."); - return; - } - var sourceFrom = mapRowToSource(from); - var sourceTo = mapRowToSource(to); - sourceModel.moveRow(sourceFrom, sourceTo); - } - } - } - - Component { - id: queryBindingComponent - Binding { - property: "query" - value: main.searchCriteria - } - } - - // UI components - Component { - id: resultsViewComponent - ResultsView { - id: view - width: parent.width - configureMode: main.configureMode - showActionListOverlay: main.showActionListOverlay - onTriggerActionRequested: { - handleTriggerResult(model.trigger(index, actionId, actionArgument)); - } - onCurrentItemChanged: { - if (!view.visible) { - return; - } - - if (currentItem) { - main.scrollToItem(currentItem); - } - } - onShowMessageRequested: { - main.showMessageRequested(icon, text); - } - } - } - - Component { - id: multiResultsViewComponent - Column { - id: multiMain - width: parent.width - property alias model: repeater.model - property bool showHeader - - property bool modelNeedsFiltering: false - property variant favoriteModels - - // Expose the same focus API as ResultsView. Used when focus changes - // from a single ResultsView source to a multi ResultsView source - // and vice-versa - signal focusOtherViewRequested(int key, int x) - - function focusLastItem() { - lastView().focusLastItem(); - } - - function focusFirstItem() { - firstView().focusFirstItem(); - } - - function focusLastItemAtX(x) { - lastView().focusLastItemAtX(x); - } - - function focusFirstItemAtX(x) { - firstView().focusFirstItemAtX(x); - } - - function isEmpty() { - for (var idx = 0; idx < repeater.count; ++idx) { - if (!repeater.itemAt(idx).isEmpty()) { - return false; - } - } - return true; - } - - function focusedItem() { - for (var idx = 0; idx < repeater.count; ++idx) { - var view = repeater.itemAt(idx); - var item = view.focusedItem(); - if (item) { - return item; - } - } - return null; - } - - function triggerFirstItem() { - for (var idx = 0; idx < repeater.count; ++idx) { - var view = repeater.itemAt(idx); - if (!view.isEmpty()) { - view.triggerFirstItem(); - return; - } - } - } - - Repeater { - id: repeater - delegate: ResultsView { - width: multiMain.width - configureMode: main.configureMode - showActionListOverlay: main.showActionListOverlay - - model: multiMain.modelNeedsFiltering - ? createFilterForModel(repeater.model.modelForRow(index)) - : repeater.model.modelForRow(index) - favoriteModels: multiMain.favoriteModels - - onModelChanged: { - if ("applicationLaunched" in model) { - model.applicationLaunched.connect(rootItem.applicationLaunched); - } - } - - onTriggerActionRequested: { - handleTriggerResult(model.trigger(index, actionId, actionArgument)); - } - - onFocusOtherViewRequested: { - if (!main.navigate(repeater, index, key, x)) { - // No view matches, forward the request - multiMain.focusOtherViewRequested(key, x); - } - } - - onCurrentItemChanged: { - if (!visible) { - return; - } - - if (currentItem) { - main.scrollToItem(currentItem); - } - } - onShowMessageRequested: { - main.showMessageRequested(icon, text); - } - } - - function viewAt(idx) { - return itemAt(idx); - } - } - - function firstView() { - return repeater.itemAt(0); - } - - function lastView() { - return repeater.itemAt(repeater.count - 1); - } - } - } - - Component { - id: sideBarListItem - - PlasmaCore.FrameSvgItem { - width: parent.width - height: theme.defaultFont.mSize.height * 2.8 - - imagePath: "widgets/listitem" - prefix: model.checked ? "pressed" : "" - - HomerunComponents.Label { - height: parent.height - - anchors { - left: parent.left - leftMargin: 10 - right: parent.right - rightMargin: 10 - } - - onImplicitWidthChanged: { - var fullWidth = Math.ceil(implicitWidth) + anchors.leftMargin + (anchors.rightMargin * 2); - - if (fullWidth > sideBarScrollArea.textWidth) { - sideBarScrollArea.textWidth = fullWidth; - } - } - - opacity: model.checked ? 1 : (isContainment? 0.8 : 0.4) - - text: model.display - font.pointSize: theme.defaultFont.pointSize * 1.4 - elide: Text.ElideRight - horizontalAlignment: Text.AlignLeft - verticalAlignment: Text.AlignVCenter - - MouseArea { - anchors.fill: parent - hoverEnabled: true - - onContainsMouseChanged: { - if (containsMouse) { - listView.currentIndex = index; - } - - listView.highlightItem.opacity = containsMouse ? 1 : 0; - } - - onClicked: { - listView.model.trigger(index); - } - } - } - } - } - - Component { - id: sideBarList - - ListView { - id: listView - - height: (theme.defaultFont.mSize.height * 2.8) * count - contentHeight: height - - anchors { - left: parent.left - right: parent.right - rightMargin: 10 - } - - delegate: sideBarListItem - - highlight: PlasmaComponents.Highlight { - hover: true - } - - highlightMoveDuration: 200 - } - } - - //- UI --------------------------------------------------------- - PlasmaExtras.ScrollArea { - id: availableScrollArea - anchors { - left: parent.left - top: parent.top - bottom: parent.bottom - } - width: configureMode ? parent.width * 0.2 : 0 - opacity: configureMode ? 1 : 0 - Behavior on width { NumberAnimation {} } - Behavior on opacity { NumberAnimation {} } - - ListView { - spacing: 6 - - model: PlasmaCore.SortFilterModel { - sourceModel: sourceRegistry.availableSourcesModel() - sortRole: "display" - } - - delegate: AvailableSourceItem { - width: ListView.view.width - text: model.display - comment: model.comment - onClicked: { - tabSourceModel.appendSource(sourceId); - } - } - } - } - - PlasmaComponents.BusyIndicator { - id: busyIndicator - y: 12 - anchors { - horizontalCenter: parent.horizontalCenter - } - - opacity: running ? 0.5 : 0 - } - - PlasmaExtras.ScrollArea { - id: sideBarScrollArea - - property int sideBarCount: 0 - property int textWidth: 0 - - width: visible ? textWidth : 0 - opacity: visible ? 1 : 0 - - visible: sideBarCount > 0 - - anchors { - left: availableScrollArea.right - top: parent.top - bottom: parent.bottom - } - - Behavior on width { NumberAnimation {} } - Behavior on opacity { NumberAnimation {} } - - Flickable { - id: sideBarFlickable - anchors.fill: parent - clip: true - contentHeight: sideBarColumn.height - - Column { - id: sideBarColumn - width: parent.width - - Repeater { - id: sideBarRepeater - model: tabSourceModel - - onItemRemoved: { - if ("sideBarModel" in item.viewModel) { - sideBarScrollArea.sideBarCount -= 1; - } - } - - delegate: Item { - id: sideBarDelegateMain - - width: parent.width - height: view.height - - property QtObject view: Item {} - property QtObject viewModel: model.model - - onViewModelChanged: { - if (view) { - view.destroy(); - } - - if ("sideBarModel" in model.model) { - view = sideBarList.createObject(sideBarDelegateMain, - {"model": model.model.sideBarModel}) - sideBarScrollArea.sideBarCount += 1; - } - } - } - } - } - } - } - - PlasmaExtras.ScrollArea { - id: centralScrollArea - anchors { - top: parent.top - bottom: parent.bottom - left: sideBarScrollArea.right - right: parent.right - } - - Flickable { - id: centralFlickable - contentHeight: centralColumn.height - - Column { - id: centralColumn - width: parent.width - - Repeater { - id: repeater - model: tabSourceModel - delegate: Column { - id: delegateMain - width: parent ? parent.width : 0 - height: main.configureMode - ? Math.min(implicitHeight, 200) - : implicitHeight - clip: main.configureMode - - property QtObject view: ResultsView {} - property string sourceId: model.sourceId - property int viewIndex: model.index - property QtObject viewModel: model.model - - SourceItem { - width: parent.width - configureMode: main.configureMode - sourceRegistry: main.sourceRegistry - sourceId: delegateMain.sourceId - - isFirst: viewIndex == 0 - isLast: viewIndex == repeater.count - 1 - - onRemoveRequested: { - tabSourceModel.remove(delegateMain.viewIndex); - } - onMoveRequested: { - tabSourceModel.move(delegateMain.viewIndex, delegateMain.viewIndex + delta); - } - - onConfigureRequested: { - var row = delegateMain.viewIndex; - var dlg = sourceRegistry.createConfigurationDialog(sourceId, model.configGroup); - if (!dlg.exec()) { - return; - } - dlg.save(); - tabSourceModel.recreateModel(row); - } - } - - onViewModelChanged: { - createViewForRow(); - } - - function createViewForRow() { - connectModel(model.model); - if (view) { - view.destroy(); - } - view = main.createView(model.model, delegateMain); - main.updateRunning(); - } - - function navigate(key, x) { - main.navigate(repeater, model.index, key, x); - } - } - - function viewAt(idx) { - return itemAt(idx).view; - } - } - } - } - } - - - Behavior on opacity { - NumberAnimation { - duration: 200 - } - } - - Timer { - id: focusTimer - interval: 500 - repeat: true - running: false - property int count: 0 - - onTriggered: { - var maxCount = 10; - console.log("Page.qml: focusTimer"); - updateFocus(); - if (main.focusedItem()) { - console.log("Page.qml: focusTimer: Focus has been set"); - stop(); - return; - } - console.log("Page.qml: focusTimer: Still no valid focus"); - count += 1; - if (count >= maxCount) { - console.log("Page.qml: focusTimer: Giving up after " + maxCount + " tries"); - stop(); - } - } - } - - onActiveFocusChanged: { - if (!activeFocus) { - return; - } - updateFocus(); - if (!focusedItem()) { - focusTimer.count = 0; - focusTimer.start(); - } - } - - //- Code ------------------------------------------------------- - function triggerFirstItem() { - for (var row = 0; row < repeater.count; ++row) { - var view = repeater.viewAt(row); - if (!view.isEmpty()) { - view.triggerFirstItem(); - return; - } - } - } - - function focusedItem() { - var row; - for (row = 0; row < repeater.count; ++row) { - var view = repeater.viewAt(row); - var item = view.focusedItem(); - if (item) { - return item; - } - } - return null; - } - - function updateFocus() { - if (repeater.count == 0) { - return; - } - var row; - for (row = 0; row < repeater.count; ++row) { - var view = repeater.viewAt(row); - if (!view.isEmpty()) { - view.focusFirstItem(); - return; - } - } - } - - function handleTriggerResult(result) { - if (result) { - closeRequested(); - } - } - - function updateRunning() { - for (var idx = 0; idx < tabSourceModel.count; ++idx) { - if (tabSourceModel.get(idx).model.running) { - busyIndicator.running = true; - return; - } - } - busyIndicator.running = false; - } - - function createFilterForModel(model) { - if (!model) { - console.log("createFilterForModel: invalid model"); - return null; - } - return genericFilterComponent.createObject(model, {"sourceModel": model}); - } - - function connectModel(model) { - if ("openSourceRequested" in model) { - model.openSourceRequested.connect(main.openSourceRequested); - } - - if ("query" in model) { - // Model supports querying itself, bind the search criteria field to its "query" property - queryBindingComponent.createObject(main, {"target": model}); - } - - if ("runningChanged" in model) { - model.runningChanged.connect(main.updateRunning); - } - - if ("applicationLaunched" in model) { - model.applicationLaunched.connect(rootItem.applicationLaunched); - } - - if ("addApp" in model) { - rootItem.applicationLaunched.connect(model.addApp); - } - } - - function createView(model, parent) { - var isMultiViewModel = "modelForRow" in model; - var modelNeedsFiltering = !("query" in model); - - var viewArgs = {}; - viewArgs["favoriteModels"] = sourceRegistry.favoriteModels; - viewArgs["model"] = model; - viewArgs["showHeader"] = showHeader; - if (modelNeedsFiltering) { - if (isMultiViewModel) { - viewArgs["modelNeedsFiltering"] = true; - } else { - viewArgs["model"] = createFilterForModel(model); - } - } - - var component = isMultiViewModel ? multiResultsViewComponent : resultsViewComponent; - var view = component.createObject(parent, viewArgs); - view.focusOtherViewRequested.connect(parent.navigate); - return view; - } - - function navigate(repeater, currentIdx, key, x) { - function nextView() { - for (var idx = currentIdx + 1; idx < repeater.count; ++idx) { - var view = repeater.viewAt(idx); - if (!view.isEmpty()) { - return view; - } - } - return null; - } - - function previousView() { - for (var idx = currentIdx - 1; idx >= 0; --idx) { - var view = repeater.viewAt(idx); - if (!view.isEmpty()) { - return view; - } - } - return null; - } - if (key == Qt.Key_Left) { - var view = previousView(); - if (view) { - view.focusLastItem(); - return true; - } - } else if (key == Qt.Key_Right) { - var view = nextView(); - if (view) { - view.focusFirstItem(); - return true; - } - } else if (key == Qt.Key_Up) { - var view = previousView(); - if (view) { - view.focusLastItemAtX(x); - return true; - } - } else if (key == Qt.Key_Down) { - var view = nextView(); - if (view) { - view.focusFirstItemAtX(x); - return true; - } - } - return false; - } - - function scrollToItem(item) { - if (!item) { - return; - } - var y = centralColumn.mapFromItem(item, 0, 0).y; - if (y < centralFlickable.contentY) { - centralFlickable.contentY = y; - } else if (y + item.height > centralFlickable.contentY + centralFlickable.height) { - centralFlickable.contentY = y + item.height - centralFlickable.height; - } - } - - function showMessage(icon, text) { - messageItem.show(icon, text); - } -} diff --git a/plasma/applets/homerun/fullscreen/package/contents/ui/Result.qml b/plasma/applets/homerun/fullscreen/package/contents/ui/Result.qml deleted file mode 100644 index a17d2d04..00000000 --- a/plasma/applets/homerun/fullscreen/package/contents/ui/Result.qml +++ /dev/null @@ -1,223 +0,0 @@ -/****************************************************************************** - * Copyright (C) 2012 by Shaun Reich * - * * - * This library is free software; you can redistribute it and/or modify * - * it under the terms of the GNU Lesser General Public License as published * - * by the Free Software Foundation; either version 2 of the License or (at * - * your option) any later version. * - * * - * This library is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * - * Library General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public License * - * along with this library; see the file COPYING.LIB. * - * If not, see . * - *****************************************************************************/ - -import QtQuick 1.1 -import org.kde.plasma.core 0.1 as PlasmaCore -import org.kde.plasma.components 0.1 as PlasmaComponents -import org.kde.qtextracomponents 0.1 as QtExtra - -import org.kde.homerun.components 0.1 as HomerunComponents - -Item { - id: main - - //- Public ---------------------------------------------------------------- - // Set by others - property int iconWidth: 64 - property alias text: resultLabel.text - property alias icon: resultIcon.source - property bool configureMode: false - property bool showActionListOverlay: false - property bool hasActionList: false - property alias dragEnabled: dragArea.dragEnabled - - // Exposed by us - property alias truncated: resultLabel.truncated - - // "highlighted" property - // This property is controlled by both the mouse and the keyboard. It cannot - // be represented as containsMouse || activeFocus because it must track the - // latest event. - // For example if mouse is over item A and user presses the right arrow - // button to reach item B, then B.highlighted should become true and - // A.highlighted should become false, even if the mouse is still over A. - property bool highlighted: false - - property alias dragContainer: dragArea.dragContainer - property alias itemIndex: dragArea.itemIndex - - signal actionTriggered(string actionId, variant actionArgument) - signal aboutToShowActionMenu(variant actionMenu) - - /** - * Emitted when the item wants to show a global message, for example to - * indicate possible actions when it is held down. - */ - signal showMessageRequested(string icon, string text) - - //- Private --------------------------------------------------------------- - property bool containsMouse: dragArea.containsMouse || (showActionListOverlay && actionListMouseArea.containsMouse) - onContainsMouseChanged: { - highlighted = containsMouse; - } - onActiveFocusChanged: { - highlighted = activeFocus; - } - - property int padding: 5 - height: resultIcon.height + resultLabel.paintedHeight + 3 * padding - - opacity: (dragArea.isDragged || dragArea.isHoldDown) ? 0.6 : 1 - Behavior on opacity { NumberAnimation {} } - - PlasmaCore.FrameSvgItem { - id: background - anchors { - fill: parent - } - - imagePath: "widgets/viewitem" - prefix: "hover" - - opacity: !dragArea.isDragged && (main.highlighted || actionMenu.opened) ? 1 : 0 - - Behavior on opacity { - NumberAnimation { - duration: 250 - easing.type: Easing.OutQuad - } - } - } - - HomerunComponents.Image { - id: resultIcon - - anchors { - topMargin: main.padding - top: parent.top - left: parent.left - right: parent.right - } - - width: iconWidth - height: iconWidth - } - - HomerunComponents.Label { - id: resultLabel - - anchors { - top: resultIcon.bottom - left: parent.left - right: parent.right - bottomMargin: main.padding - topMargin: main.padding - rightMargin: main.padding - leftMargin: main.padding - } - - elide: Text.ElideRight - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignTop - wrapMode: Text.Wrap - maximumLineCount: 2 - } - - HomerunComponents.DragArea { - id: dragArea - acceptedButtons: Qt.LeftButton | Qt.RightButton - anchors.fill: parent - hoverEnabled: true - enabled: !configureMode - onClicked: { - if (mouse.button == Qt.LeftButton) { - actionTriggered("", null); - } else if (mouse.button == Qt.RightButton && hasActionList) { - openActionMenu(main); - } - } - - onLongPressTimeReached: { - var icon = "dialog-information"; - var text; - if (hasActionList && dragEnabled) { - text = i18n("Drag to reorder; release to show menu"); - } else if (hasActionList) { - text = i18n("Release to show menu"); - } else if (dragEnabled) { - text = i18n("Drag to reorder"); - } else { - icon = "dialog-error"; - text = i18n("This item has no menu and cannot be dragged"); - } - showMessageRequested(icon, text); - } - - onLongPressReleased: { - if (hasActionList) { - openActionMenu(main); - } - } - } - - - Item { - anchors { - right: parent.right - rightMargin: main.padding - top: parent.top - topMargin: main.padding - } - width: 16 - height: width - opacity: actionListMouseArea.containsMouse ? 1 : ((main.highlighted || actionMenu.opened) ? 0.5 : 0) - Behavior on opacity { NumberAnimation {} } - visible: showActionListOverlay && hasActionList - - PlasmaComponents.ToolButton { - id: actionListButton - iconSource: "go-down" - anchors.fill: parent - // Hack to get a background on mouse-over only - flat: !actionListMouseArea.containsMouse - } - - QtExtra.MouseEventListener { - id: actionListMouseArea - anchors.fill: parent - hoverEnabled: true - enabled: !configureMode && hasActionList - onClicked: openActionMenu(actionListButton) - } - } - - - HomerunComponents.ActionMenu { - id: actionMenu - onActionClicked: { - main.actionTriggered(actionId, actionArgument); - } - } - - Keys.onPressed: { - if (!hasActionList) { - return; - } - if (event.key == Qt.Key_M || event.key == Qt.Key_Menu) { - event.accepted = true; - openActionMenu(main); - } - } - - // Code - function openActionMenu(visualParent) { - aboutToShowActionMenu(actionMenu); - actionMenu.visualParent = visualParent; - actionMenu.open(); - } -} diff --git a/plasma/applets/homerun/fullscreen/package/contents/ui/ResultsView.qml b/plasma/applets/homerun/fullscreen/package/contents/ui/ResultsView.qml deleted file mode 100644 index 7dd692cf..00000000 --- a/plasma/applets/homerun/fullscreen/package/contents/ui/ResultsView.qml +++ /dev/null @@ -1,387 +0,0 @@ -/****************************************************************************** - * Copyright (C) 2012 by Shaun Reich * - * * - * This library is free software; you can redistribute it and/or modify * - * it under the terms of the GNU Lesser General Public License as published * - * by the Free Software Foundation; either version 2 of the License or (at * - * your option) any later version. * - * * - * This library is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * - * Library General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public License * - * along with this library; see the file COPYING.LIB. * - * If not, see . * - *****************************************************************************/ - -import QtQuick 1.1 -import org.kde.homerun.components 0.1 as HomerunComponents -import org.kde.homerun.fixes 0.1 as HomerunFixes -import org.kde.plasma.core 0.1 as PlasmaCore -import org.kde.plasma.components 0.1 as PlasmaComponents -import org.kde.qtextracomponents 0.1 as QtExtra - -FocusScope { - id: main - - //- Public -------------------------------------------------- - property variant favoriteModels - - property bool showHeader: true - /* We intentionally do not use an alias for "model" here. With an alias, - * headerLabel cannot access model.name of sub models returned by - * RunnerModel. - */ - property QtObject model - - property bool configureMode: false - property bool showActionListOverlay: false - - property alias currentItem: gridView.currentItem - - signal triggerActionRequested(int index, string actionId, variant actionArgument) - - signal focusOtherViewRequested(int key, int x) - - signal showMessageRequested(string icon, string text) - - function isEmpty() { - return gridView.count == 0; - } - - function focusLastItem() { - focusItemAt(gridView.count - 1); - } - - function focusFirstItem() { - focusItemAt(0); - } - - function focusLastItemAtX(x) { - for (var y = gridView.height - gridView.cellHeight / 2; y > 0; y -= gridView.cellHeight) { - var idx = gridView.indexAt(x, y); - if (idx != -1) { - focusItemAt(idx); - return; - } - } - focusLastItem(); - } - - function focusFirstItemAtX(x) { - var idx = gridView.indexAt(x, gridView.cellHeight / 2); - if (idx != -1) { - focusItemAt(idx); - } else { - focusLastItem(); - } - } - - function focusedItem() { - if (currentItem && currentItem.activeFocus) { - return currentItem; - } else { - return null - } - } - - function triggerFirstItem() { - triggerAction(0, "", null); - } - - //- Private ------------------------------------------------- - function focusItemAt(idx) { - if (idx < 0 || idx >= gridView.count) { - return; - } - gridView.currentIndex = idx; - gridView.currentItem.forceActiveFocus(); - } - height: visible ? childrenRect.height : 0 - visible: calculateVisibility() - - function calculateVisibility() { - if (!model) { - return false; - } - - if (!gridView.count) { - return false; - } - - if ("hidden" in model && model.hidden) { - return false; - } - - return true; - } - - //FIXME: figure out sizing properly.. - property int iconWidth: 64 - property int resultItemWidth: 128 - property int resultItemHeight: iconWidth + 3 * theme.defaultFont.mSize.height - - // Components - Component { - id: result - FocusScope { - width: gridView.cellWidth - height: gridView.cellHeight - property alias text: resultMain.text - property alias icon: resultMain.icon - - Result { - id: resultMain - focus: true - iconWidth: main.iconWidth - width: main.resultItemWidth - configureMode: main.configureMode - showActionListOverlay: main.showActionListOverlay - dragContainer: gridDragContainer - dragEnabled: ("canMoveRow" in main.model) ? main.model.canMoveRow : false - - text: model.display - icon: model.decoration - itemIndex: model.index - - onHighlightedChanged: { - if (highlighted) { - gridView.currentIndex = model.index; - } - } - - hasActionList: model.favoriteId || (("hasActionList" in model) && model.hasActionList) - - onAboutToShowActionMenu: { - fillActionMenu(actionMenu); - } - - onActionTriggered: { - triggerAction(model.index, actionId, actionArgument); - } - - onShowMessageRequested: { - main.showMessageRequested(icon, text); - } - - function fillActionMenu(actionMenu) { - // Accessing actionList can be a costly operation, so we don't - // access it until we need the menu - var lst = model.hasActionList ? model.actionList : []; - var action = createFavoriteAction(); - if (action) { - if (lst.length > 0) { - var separator = { "type": "separator" }; - lst.unshift(action, separator); - } else { - lst = [action]; - } - } - actionMenu.actionList = lst; - } - - function createFavoriteAction() { - var favoriteModel = favoriteModelForFavoriteId(model.favoriteId); - if (favoriteModel === null) { - return null; - } - var action = {}; - if (favoriteModel.isFavorite(model.favoriteId)) { - action.text = i18n("Remove from Favorites"); - action.icon = QIcon("list-remove"); - action.actionId = "_homerun_favorite_remove"; - } else { - action.text = i18n("Add to Favorites"); - action.icon = QIcon("bookmark-new"); - action.actionId = "_homerun_favorite_add"; - } - action.actionArgument = {favoriteId: model.favoriteId, text: model.display}; - return action; - } - - } - } - } - - // UI - HomerunComponents.Label { - id: headerLabel - - width: parent.width - height: theme.defaultFont.mSize.height * 2.8 - - visible: showHeader - opacity: ("plasmoid" in this) ? 1 : 0.4 - - text: main.model ? main.model.name : "-" - font.pointSize: theme.defaultFont.pointSize * 1.4 - horizontalAlignment: Text.AlignLeft - verticalAlignment: Text.AlignVCenter - } - - GridView { - id: gridView - anchors { - top: showHeader ? headerLabel.bottom : parent.top - left: parent.left - right: parent.right - } - - model: main.model - focus: true - - objectName: "GridView:" + (main.model ? main.model.objectName : "-") - - HomerunComponents.DragContainer { - id: gridDragContainer - anchors.fill: parent - model: main.model - } - - /* - // Focus debug help - LogText { - anchors.right: parent.right - anchors.bottom: parent.bottom - text: - "activeFocus=" + gridView.activeFocus - + "\ncurrentIndex=" + gridView.currentIndex - + "\ncurrentItem.activeFocus=" + (gridView.currentItem ? gridView.currentItem.activeFocus : "-") - + "\ncurrentItem.label=" + (gridView.currentItem ? gridView.currentItem.text : "-") - } - */ - - // Defining "height" as "contentHeight" would be simpler, but it causes "Binding loop detected" error messages - height: Math.ceil(count / Math.floor(width / cellWidth)) * cellHeight - - // Disable the GridView flickable so that it does not interfer with the global flickable - interactive: false - - cellWidth: resultItemWidth - cellHeight: resultItemHeight - //TODO: something sane? - cacheBuffer: 128 * 10 //10 above, 10 below caching - - delegate: result - - Keys.onPressed: { - // We must handle arrow key navigation ourself because 'interactive' is false - if (event.modifiers == Qt.NoModifier) { - var oldIndex = currentIndex; - if (event.key == Qt.Key_Left) { - moveCurrentIndexLeft(); - } else if (event.key == Qt.Key_Right) { - moveCurrentIndexRight(); - } else if (event.key == Qt.Key_Up) { - moveCurrentIndexUp(); - } else if (event.key == Qt.Key_Down) { - moveCurrentIndexDown(); - } else { - return; - } - if (currentIndex == oldIndex) { - // We didn't move, ask to move to another view - focusOtherViewRequested(event.key, currentItem ? currentItem.x : 0); - } - if (currentIndex != oldIndex || !activeFocus) { - // Only accept the event if we moved. Otherwise one can't - // press Up from the first row to focus the search field. - event.accepted = true; - } - } - } - - Keys.onReturnPressed: triggerAction(currentIndex, "", null) - } - - PlasmaCore.FrameSvgItem { - id: tooltip - imagePath: "widgets/tooltip" - property Item target: (gridView.currentItem && gridView.currentItem.highlighted && gridView.currentItem.truncated) ? gridView.currentItem : null - width: label.width + margins.left + margins.right - height: label.height + margins.top + margins.bottom - - opacity: target ? 1 : 0 - - onTargetChanged: { - if (target) { - // Manually update these properties so that they do not get reset as soon as target becomes null: - // we don't want the properties to be updated then because we need to keep the old text and coordinates - // while the tooltip is fading out. - label.text = target.text; - x = tooltipX(); - y = target.y; - } - } - - PlasmaComponents.Label { - id: label - x: parent.margins.left - y: parent.margins.top - } - - Behavior on opacity { - NumberAnimation { duration: 250; } - } - - function tooltipX() { - var left = gridView.mapToItem(main, target.x, 0).x; - var value = left + (target.width - width) / 2; - if (value < 0) { - return 0; - } - if (value > gridView.width - width) { - return gridView.width - width; - } - return value; - } - } - - // Code - function favoriteModelForFavoriteId(favoriteId) { - if (favoriteId === undefined || favoriteId === "") { - return null; - } - var lst = favoriteId.split(":"); - if (lst.length === 0) { - return null; - } - var model = favoriteModels[lst[0]]; - if (model === undefined) { - console.log("favoriteModelForFavoriteId(): No favorite model for favoriteId '" + favoriteId + "'"); - return null; - } else { - return model; - } - } - - function handleFavoriteAction(actionId, actionArgument) { - var favoriteId = actionArgument.favoriteId; - var favoriteModel = favoriteModelForFavoriteId(favoriteId); - if (actionId == "_homerun_favorite_remove") { - favoriteModel.removeFavorite(favoriteId); - } else if (actionId == "_homerun_favorite_add") { - favoriteModel.addFavorite(favoriteId); - showMessageRequested("bookmarks", i18n("%1 has been added to your favorites", actionArgument.text)); - } else { - console.log("Unknown homerun favorite actionId: " + actionId); - } - } - - function triggerAction(index, actionId, actionArgument) { - // Looks like String.startsWith does not exist in the JS interpreter we use :/ - function startsWith(txt, needle) { - return txt.substr(0, needle.length) === needle; - } - if (configureMode) { - return; - } - if (startsWith(actionId, "_homerun_favorite_")) { - handleFavoriteAction(actionId, actionArgument); - return; - } - triggerActionRequested(index, actionId, actionArgument); - } -} diff --git a/plasma/applets/homerun/fullscreen/package/contents/ui/SlidingContainer.qml b/plasma/applets/homerun/fullscreen/package/contents/ui/SlidingContainer.qml deleted file mode 100644 index 2d658a60..00000000 --- a/plasma/applets/homerun/fullscreen/package/contents/ui/SlidingContainer.qml +++ /dev/null @@ -1,36 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -import QtQuick 1.1 - -Item { - id: main - - property bool show: true - - height: show ? childrenRect.height : 0 - Behavior on height { - NumberAnimation { - duration: 200 - easing.type: Easing.OutQuad - } - } - - clip: true -} diff --git a/plasma/applets/homerun/fullscreen/package/contents/ui/SourceItem.qml b/plasma/applets/homerun/fullscreen/package/contents/ui/SourceItem.qml deleted file mode 100644 index 1466925d..00000000 --- a/plasma/applets/homerun/fullscreen/package/contents/ui/SourceItem.qml +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright 2012 Aurélien Gâteau - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -import QtQuick 1.1 -import org.kde.plasma.core 0.1 as PlasmaCore -import org.kde.plasma.components 0.1 as PlasmaComponents - -SlidingContainer { - id: main - property QtObject sourceRegistry - property string sourceId - - property bool configureMode: false - - property bool isFirst: false - property bool isLast: false - - show: configureMode - - signal removeRequested - signal moveRequested(int delta) - signal configureRequested - - PlasmaCore.FrameSvgItem { - id: frame - imagePath: "widgets/tooltip" - width: parent.width - height: label.height + margins.top + margins.bottom - - PlasmaComponents.Label { - id: label - x: parent.margins.left - y: parent.margins.top - text: { - var name = ""; - if (sourceId) { - name = sourceRegistry.visibleNameForSource(sourceId); - if (!name) { - name = i18n("Broken source '%1'", sourceId); - } - } - return name; - } - } - - Row { - id: buttonRow - height: label.height - anchors { - right: parent.right - rightMargin: parent.margins.right - top: parent.top - topMargin: parent.margins.top - } - - PlasmaComponents.ToolButton { - id: configureButton - iconSource: "configure" - visible: sourceId ? sourceRegistry.isSourceConfigurable(sourceId) : false - onClicked: main.configureRequested() - } - - PlasmaComponents.ToolButton { - id: upButton - iconSource: "go-up" - enabled: !main.isFirst - onClicked: main.moveRequested(-1) - } - - PlasmaComponents.ToolButton { - id: downButton - iconSource: "go-down" - enabled: !main.isLast - onClicked: main.moveRequested(1) - } - - PlasmaComponents.ToolButton { - id: removeButton - iconSource: "list-remove" - onClicked: main.removeRequested() - } - } - } -} diff --git a/plasma/applets/homerun/fullscreen/package/contents/ui/TabContent.qml b/plasma/applets/homerun/fullscreen/package/contents/ui/TabContent.qml deleted file mode 100644 index e2addc36..00000000 --- a/plasma/applets/homerun/fullscreen/package/contents/ui/TabContent.qml +++ /dev/null @@ -1,317 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -import QtQuick 1.1 -import org.kde.homerun.components 0.1 as HomerunComponents -import org.kde.plasma.core 0.1 as PlasmaCore -import org.kde.plasma.components 0.1 as PlasmaComponents -import org.kde.qtextracomponents 0.1 as QtExtra - -import "TabContentInternal.js" as TabContentInternal - -Item { - id: main - - //- Public ---------------------------------------------------- - // Defined by outside world - property Item rootItem - property QtObject sourceRegistry - property QtObject tabSourceModel - property string tabIconSource - property string tabText - property string searchCriteria - property bool configureMode: false - property bool showActionListOverlay: false - - // Exposed by ourself - property bool canGoBack: false - property bool canGoForward: false - property Item currentPage - - signal closeRequested - signal updateTabOrderRequested - signal setSearchFieldRequested(string text) - - //- Private --------------------------------------------------- - Component { - id: pageComponent - Page { - anchors.fill: parent - rootItem: main.rootItem - configureMode: main.configureMode - showActionListOverlay: main.showActionListOverlay - onCloseRequested: { - main.closeRequested(); - } - onOpenSourceRequested: { - main.openSource(sourceId, sourceArguments); - } - onShowMessageRequested: { - messageItem.show(icon, text); - } - } - } - - // Ui - SlidingContainer { - id: editTabRow - anchors { - top: parent.top - left: parent.left - right: parent.right - } - show: configureMode - - Row { - anchors.horizontalCenter: parent.horizontalCenter - spacing: 12 - - PlasmaComponents.Label { - text: i18n("Tab Icon:") - } - - PlasmaComponents.ToolButton { - flat: false - iconSource: main.tabIconSource - onClicked: { - var name = iconDialog.getIcon(); - if (name != "") { - main.tabIconSource = name; - } - } - - HomerunComponents.IconDialog { - id: iconDialog - } - } - - PlasmaComponents.Label { - text: i18n("Tab Label:") - } - - PlasmaComponents.TextField { - text: main.tabText - onTextChanged: main.tabText = text - } - } - } - - SlidingContainer { - // navRow = back|forward + breadcrumbs - id: navRow - property int maxHeight: 32 - show: canGoBack - - anchors { - top: editTabRow.bottom - left: parent.left - right: parent.right - } - - PlasmaComponents.ToolButton { - id: backButton - width: height - height: navRow.maxHeight - - flat: false - iconSource: "go-previous" - onClicked: goBack() - } - - PlasmaComponents.ToolButton { - id: forwardButton - anchors { - left: backButton.right - } - width: height - height: navRow.maxHeight - enabled: canGoForward - - flat: false - iconSource: "go-next" - onClicked: goForward() - } - - PlasmaComponents.ButtonRow { - id: breadcrumbRow - anchors { - left: forwardButton.right - leftMargin: 12 - } - spacing: 0 - height: navRow.maxHeight - - PlasmaComponents.ToolButton { - height: breadcrumbRow.height - flat: false - iconSource: tabIconSource - text: tabText - onClicked: TabContentInternal.goTo(0); - } - - Repeater { - id: breadcrumbRepeater - model: currentPage.pathModel - delegate: PlasmaComponents.ToolButton { - height: breadcrumbRow.height - - flat: false - checked: model.index == breadcrumbRepeater.count - 1 - text: "› " + model.display - onClicked: { - // Do not use 'checked' here because by the time - // clicked() is emitted, 'checked' has already been set - // to true - if (model.index != breadcrumbRepeater.count - 1) { - openSource(model.sourceId, model.sourceArguments); - } - } - } - } - } - } - - PlasmaCore.SvgItem { - id: hline - anchors { - left: parent.left - right: parent.right - bottom: navRow.bottom - bottomMargin: -12 - } - height: naturalSize.height - z: 1000 - svg: PlasmaCore.Svg { - imagePath: "widgets/scrollwidget" - } - elementId: "border-top" - } - - Item { - id: pageContainer - anchors { - left: parent.left - leftMargin: 12 - top: hline.top - right: parent.right - bottom: parent.bottom - } - } - - MessageItem { - id: messageItem - anchors { - top: navRow.show ? navRow.top : hline.bottom - topMargin: navRow.show ? 0 : 6 - horizontalCenter: parent.horizontalCenter - } - } - - // Scripting - Component.onCompleted: { - var page = createPage(tabSourceModel); - TabContentInternal.addPage(page); - TabContentInternal.goToLastPage(); - } - - onActiveFocusChanged: { - if (activeFocus) { - currentPage.forceActiveFocus(); - } - } - - onSearchCriteriaChanged: { - currentPage.searchCriteria = searchCriteria; - } - - onCurrentPageChanged: { - setSearchFieldRequested(currentPage.searchCriteria); - } - - function goBack() { - TabContentInternal.goBack(); - } - - function goForward() { - TabContentInternal.goForward(); - } - - function goUp() { - var model = currentPage.pathModel; - if (model.count >= 2) { - // count - 1 is the breadcrumb for the current content - // count - 2 is the breadcrumb for the content up - var item = model.get(model.count - 2); - openSource(item.sourceId, item.sourceArguments); - } else { - // "root" item is not in the path model, so we use a different way - // to get to it - TabContentInternal.goTo(0); - } - } - - Component { - id: dynamicTabSourceModelComponent - ListModel { - } - } - - function openSource(sourceId, sourceArguments) { - // This tabSourceModel should look-like the C++ SourceModel used when - // tab content is loaded from the config file. - var tabSourceModel = dynamicTabSourceModelComponent.createObject(main); - var page = createPage(tabSourceModel, { "showHeader": false }); - - // Create the model for sourceId after creating the page so that the page - // can be used as its parent, avoiding memory leaks. - // See https://bugs.kde.org/show_bug.cgi?id=310217 - tabSourceModel.append({ - sourceId: sourceId, - model: sourceRegistry.createModelFromArguments(sourceId, sourceArguments, page), - configGroup: null - }) - TabContentInternal.addPage(page); - TabContentInternal.goToLastPage(); - page.forceActiveFocus(); - } - - function createPage(sourceModel, viewExtraArgs /*= {}*/) { - var args = { - sourceRegistry: sourceRegistry, - tabSourceModel: sourceModel, - }; - if (viewExtraArgs !== undefined) { - for (var key in viewExtraArgs) { - args[key] = viewExtraArgs[key]; - } - } - - return pageComponent.createObject(pageContainer, args); - } - - function triggerFirstItem() { - currentPage.triggerFirstItem(); - } - - function reset() { - TabContentInternal.goTo(0); - TabContentInternal.clearHistoryAfterCurrentPage(); - searchCriteria = ""; - } -} diff --git a/plasma/applets/homerun/fullscreen/package/contents/ui/TabContentInternal.js b/plasma/applets/homerun/fullscreen/package/contents/ui/TabContentInternal.js deleted file mode 100644 index bfef9d26..00000000 --- a/plasma/applets/homerun/fullscreen/package/contents/ui/TabContentInternal.js +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright 2012 Aurélien Gâteau - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -var pages = new Array(); -var currentIndex = -1; - -function dumpPages() { - console.log("### History stack ###"); - pages.forEach(function(page, index) { - var prefix = index == currentIndex ? "> " : "- "; - console.log(prefix + page.objectName); - }); -} - -function addPage(page) { - clearHistoryAfterCurrentPage(); - pages.push(page); -} - -function clearHistoryAfterCurrentPage() { - if (currentIndex > -1) { - var lst = pages.splice(currentIndex + 1); - lst.forEach(function(x) { x.destroy(); }); - } -} - -function goToPage(wantedPage) { - var idx = pages.indexOf(wantedPage); - if (idx != -1) { - goTo(idx); - } -} - -function goToLastPage() { - goTo(pages.length - 1); -} - -function goTo(index) { - if (currentIndex != -1) { - var oldPage = pages[currentIndex]; - oldPage.opacity = 0; - oldPage.previouslyFocusedItem = oldPage.focusedItem(); - } - currentIndex = index; - pages[index].opacity = 1; - currentPage = pages[index]; - if (currentPage.previouslyFocusedItem) { - currentPage.previouslyFocusedItem.forceActiveFocus(); - } - _updateCanGoBackForward(); - - //dumpPages(); -} - -function goBack() { - if (currentIndex > 0) { - goTo(currentIndex - 1); - } -} - -function goForward() { - if (currentIndex < pages.length - 1) { - goTo(currentIndex + 1); - } -} - -function _updateCanGoBackForward() { - canGoBack = currentIndex > 0; - canGoForward = currentIndex < pages.length - 1; -} diff --git a/plasma/applets/homerun/fullscreen/package/contents/ui/TabSideButton.qml b/plasma/applets/homerun/fullscreen/package/contents/ui/TabSideButton.qml deleted file mode 100644 index 94d3fe48..00000000 --- a/plasma/applets/homerun/fullscreen/package/contents/ui/TabSideButton.qml +++ /dev/null @@ -1,30 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -import QtQuick 1.1 -import org.kde.plasma.components 0.1 as PlasmaComponents - -PlasmaComponents.ToolButton { - anchors { - verticalCenter: parent.verticalCenter - } - height: parent.height - width: height - Behavior on opacity { NumberAnimation { duration: 250 }} -} diff --git a/plasma/applets/homerun/fullscreen/package/contents/ui/config.ui b/plasma/applets/homerun/fullscreen/package/contents/ui/config.ui deleted file mode 100644 index 6c082875..00000000 --- a/plasma/applets/homerun/fullscreen/package/contents/ui/config.ui +++ /dev/null @@ -1,108 +0,0 @@ - - - HomerunContainmentConfig - - - - 0 - 0 - 320 - 278 - - - - - - - Text Color: - - - kcfg_textColor - - - - - - - - - - Text Shadow: - - - kcfg_shadowModeNone - - - - - - - None - - - - - - - Automatic - - - - - - - - - Custom: - - - - - - - false - - - - 0 - 0 - - - - - - - - - - - KColorButton - QPushButton -
kcolorbutton.h
-
-
- - kcfg_textColor - kcfg_shadowModeNone - kcfg_shadowModeAuto - - - - - kcfg_shadowModeCustom - toggled(bool) - kcfg_shadowColor - setEnabled(bool) - - - 136 - 106 - - - 136 - 133 - - - - -
diff --git a/plasma/applets/homerun/fullscreen/package/contents/ui/main.qml b/plasma/applets/homerun/fullscreen/package/contents/ui/main.qml deleted file mode 100644 index d7d52a16..00000000 --- a/plasma/applets/homerun/fullscreen/package/contents/ui/main.qml +++ /dev/null @@ -1,453 +0,0 @@ -/* - * Copyright 2011 Marco Martin - * Copyright (C) 2012 by Shaun Reich - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -import QtQuick 1.1 -import org.kde.homerun.components 0.1 as HomerunComponents -import org.kde.plasma.core 0.1 as PlasmaCore -import org.kde.plasma.components 0.1 as PlasmaComponents -import org.kde.qtextracomponents 0.1 as QtExtra -import org.kde.homerun.fixes 0.1 as HomerunFixes - -Item { - id: main - signal closeRequested - signal applicationLaunched(string application) - property QtObject configureAction - property bool isContainment - - property string configFileName - - property alias currentTabContent: tabGroup.currentTab - - property bool configureMode: false - property bool showActionListOverlay: globalSettings.showActionListOverlay - property bool showDesktopToolBox: globalSettings.showDesktopToolBox - - // Internal - property real outerPadding: 12 - property real innerPadding: 6 // padding between header items - - HomerunComponents.GlobalSettings { - id: globalSettings - configFileName: main.configFileName - } - - // Models - HomerunComponents.TabModel { - id: tabModel - configFileName: main.configFileName - sourceRegistry: sourceRegistry - } - - HomerunComponents.SourceRegistry { - id: sourceRegistry - configFileName: main.configFileName - } - - HomerunFixes.ToolBoxToggle { - id: toolBoxToggle - visible: showDesktopToolBox - } - - // Components - Component { - id: tabContentComponent - TabContent { - id: tabContentMain - property Item tabButton - rootItem: main - tabIconSource: tabButton.iconSource - tabText: tabButton.realText - configureMode: main.configureMode - showActionListOverlay: main.showActionListOverlay - onCloseRequested: isContainment ? reset() : main.closeRequested() - onSetSearchFieldRequested: searchField.text = text - onTabTextChanged: { - if (configureMode) { - tabModel.setDataForRow(tabButton.index, "display", tabText); - } - } - onTabIconSourceChanged: { - if (configureMode) { - tabModel.setDataForRow(tabButton.index, "decoration", tabIconSource); - } - } - } - } - - // Actions (used for keyboard shortcuts) - HomerunComponents.ActionManager { - id: actionManager - configFileName: main.configFileName - HomerunComponents.Action { - objectName: "go-to-previous-tab" - text: i18n("Go to previous tab") - keys: ["Ctrl+PgUp"] - onTriggered: tabBar.decrementCurrentIndex() - } - HomerunComponents.Action { - objectName: "go-to-next-tab" - text: i18n("Go to next tab") - keys: ["Ctrl+PgDown"] - onTriggered: tabBar.incrementCurrentIndex() - } - HomerunComponents.Action { - objectName: "search" - text: i18n("Focus search field") - keys: ["Ctrl+F", "/"] - onTriggered: searchField.forceActiveFocus() - } - HomerunComponents.Action { - objectName: "go-back" - text: i18n("Go back") - keys: ["Alt+Left"] - onTriggered: currentTabContent.goBack() - } - HomerunComponents.Action { - objectName: "go-forward" - text: i18n("Go forward") - keys: ["Alt+Right"] - onTriggered: currentTabContent.goBack() - } - HomerunComponents.Action { - objectName: "go-up" - text: i18n("Go up") - keys: ["Alt+up"] - onTriggered: currentTabContent.goUp() - } - } - - // UI - HomerunComponents.TabBar { - id: tabBar - - property bool selectNewTab: false - - anchors { - top: parent.top - topMargin: main.outerPadding - left: parent.left - leftMargin: main.outerPadding - right: configureMode ? addTabButton.left : searchField.left - rightMargin: configureMode ? 0 : innerPadding - } - - model: tabModel - delegate: HomerunComponents.TabButton { - id: tabButtonMain - property string realText: model.display - text: model.display || i18nc("Used for tabs which have no name", "") - iconSource: model.decoration - property QtObject tabSourceModel: model.sourceModel - index: model.index - - rightSide: [ - TabSideButton { - opacity: configureMode ? 1 : 0 - iconSource: "go-previous" - enabled: index > 0 - onClicked: tabModel.moveRow(index, index - 1) - }, - TabSideButton { - opacity: configureMode ? 1 : 0 - iconSource: "go-next" - enabled: index < tabButtonMain.ListView.view.count - 1 - onClicked: tabModel.moveRow(index, index + 1) - }, - TabSideButton { - opacity: configureMode ? 1 : 0 - iconSource: "list-remove" - onClicked: tabModel.removeRow(index) - } - ] - } - - onCurrentItemChanged: { - if (!currentItem.tab) { - createTabContent(currentItem); - } - var hadFocus = !searchField.activeFocus; - tabGroup.currentTab = currentItem.tab; - if (hadFocus) { - tabGroup.currentTab.forceActiveFocus(); - } - } - - function createTabContent(tabButton) { - tabButton.tab = tabContentComponent.createObject(tabGroup, { - tabSourceModel: tabButton.tabSourceModel, - sourceRegistry: sourceRegistry, - tabButton: tabButton, - }); - } - - onCountChanged: { - if (selectNewTab) { - selectNewTab = false; - currentIndex = count - 1; - } - } - } - - // Add tab button - PlasmaComponents.ToolButton { - id: addTabButton - anchors { - right: endConfigureButton.left - top: tabBar.top - bottom: tabBar.bottom - rightMargin: innerPadding - } - width: height + 1 // +1 to workaround ToolButton using a round frame if width == height - opacity: configureMode ? 1 : 0 - - flat: false - iconSource: "list-add" - onClicked: { - tabBar.selectNewTab = true; - tabModel.appendRow(); - } - } - - // End config button - PlasmaComponents.ToolButton { - id: endConfigureButton - anchors { - right: configButton.left - top: tabBar.top - bottom: tabBar.bottom - rightMargin: innerPadding - } - opacity: configureMode ? 1 : 0 - - flat: false - text: i18nc("Button to leave configure mode", "Done") - onClicked: configureMode = false; - } - - - // Search area - HomerunFixes.TextField { - id: searchField - - anchors { - right: configButton.left - top: tabBar.top - bottom: tabBar.bottom - rightMargin: innerPadding - } - - width: parent.width / 4 - opacity: configureMode ? 0 : 1 - - focus: true - - clearButtonShown: true - placeholderText: i18n("Search in current tab...") - - KeyNavigation.tab: content - KeyNavigation.backtab: content - KeyNavigation.down: content - - onTextChanged: currentTabContent.searchCriteria = text; - - onAccepted: currentTabContent.triggerFirstItem() - } - - // Config button - PlasmaComponents.ToolButton { - id: configButton - anchors { - right: parent.right - top: tabBar.top - bottom: tabBar.bottom - rightMargin: main.outerPadding - } - iconSource: "applications-system" - - property QtObject menu - - onClicked: { - if (!menu) { - menu = configMenuComponent.createObject(configButton); - } - menu.open(); - } - - Component { - id: configMenuComponent - PlasmaComponents.ContextMenu { - visualParent: configButton - PlasmaComponents.MenuItem { - text: configureMode ? i18n("End Configure Tabs") : i18n("Configure Tabs"); - onClicked: { - configureMode = !configureMode; - if (configureMode) { - currentTabContent.reset(); - } - } - } - PlasmaComponents.MenuItem { - text: i18n("Configure Shortcuts...") - onClicked: actionManager.configure() - } - PlasmaComponents.MenuItem { - text: i18n("Show Action List Buttons"); - checkable: true - checked: showActionListOverlay - onCheckedChanged: { - globalSettings.showActionListOverlay = checked; - } - } - PlasmaComponents.MenuItem { - visible: isContainment - text: i18n("Show Desktop Tool Box"); - checkable: true - checked: showDesktopToolBox - onCheckedChanged: { - globalSettings.showDesktopToolBox = checked; - } - } - PlasmaComponents.MenuItem { - separator: true - } - PlasmaComponents.MenuItem { - text: i18n("Restore Tabs to Default"); - onClicked: { - var ret = messageBox.warningContinueCancel( - i18n("Are you sure you want to restore tabs?\nRestoring tabs will reset your configuration to the default Homerun tabs.\nYour lists of favorite applications and places will remain untouched."), - i18n("Restore Tabs"), - i18n("Restore Tabs")); - - if (ret == HomerunComponents.MessageBox.Continue) { - tabModel.resetConfig(); - } - } - } - PlasmaComponents.MenuItem { - separator: true - } - PlasmaComponents.MenuItem { - // We do not use helpMenuActions.text(HomerunComponents.HelpMenuActions.AboutApplication) - // because it returns Plasma when running as a containment - text: i18n("About %1", "Homerun") - onClicked: helpMenuActions.trigger(HomerunComponents.HelpMenuActions.AboutApplication) - } - PlasmaComponents.MenuItem { - text: helpMenuActions.text(HomerunComponents.HelpMenuActions.ReportBug) - onClicked: helpMenuActions.trigger(HomerunComponents.HelpMenuActions.ReportBug) - } - } - } - - HomerunComponents.HelpMenuActions { - id: helpMenuActions - } - HomerunComponents.MessageBox { - id: messageBox - } - } - - // Main content - Item { - id: content - anchors { - top: tabBar.bottom - bottom: parent.bottom - left: parent.left - right: parent.right - topMargin: main.outerPadding - } - - HomerunComponents.TabGroup { - id: tabGroup - anchors.fill: parent - } - - KeyNavigation.tab: searchField - KeyNavigation.backtab: searchField - KeyNavigation.up: searchField - - onActiveFocusChanged: { - if (activeFocus) { - currentTabContent.forceActiveFocus(); - } - } - } - - function resizeToFitScreen() { - // fit the containment to within the boundaries of the visible panels - // (so no panels should be covering any information) - // rect 0 is available screen region, rect 1 is for panels not 100% wide - var screen = plasmoid.screen; - var sourceRegion = plasmoid.availableScreenRegion(screen)[1]; - if (sourceRegion === undefined) { - sourceRegion = plasmoid.availableScreenRegion(screen)[0]; - } - - main.y = sourceRegion.y; - main.x = sourceRegion.x; - main.height = sourceRegion.height; - main.width = sourceRegion.width; - } - - // Code - Component.onCompleted: { - isContainment = "plasmoid" in this; - if (isContainment) { - // enable right click configure - configureAction = plasmoid.action("configure"); - configureAction.enabled = true; - - plasmoid.availableScreenRegionChanged.connect(resizeToFitScreen); - resizeToFitScreen(); - - toolBoxToggle.toolBox = plasmoid.toolBox; - - // Set config file only here so that when running homerunviewer with - // a custom config file (with --config /path/to/customrc). Homerun - // directly loads the custom config file. - // If value of configFileName were set when it is declared, Homerun - // would first load the default config file, then overwrite it with - // the custom one. - main.configFileName = "homerunrc"; - } - } - - Connections { - target: main - onCurrentTabContentChanged: { - searchField.text = currentTabContent.searchCriteria; - } - } - - function reset() { - tabBar.currentIndex = 0; - for (idx = 0; idx < tabGroup.data.length; ++idx) { - var tabContent = tabGroup.data[idx]; - if (tabContent && tabContent.reset) { - tabContent.reset(); - } - } - configureMode = false; - searchField.text = ""; - searchField.forceActiveFocus(); - } -} diff --git a/plasma/applets/homerun/fullscreen/package/metadata.desktop.cmake b/plasma/applets/homerun/fullscreen/package/metadata.desktop.cmake deleted file mode 100644 index 1a0ab64c..00000000 --- a/plasma/applets/homerun/fullscreen/package/metadata.desktop.cmake +++ /dev/null @@ -1,81 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -# ctxt: "Homerun" is a product name -Name=Homerun -Name[bs]=Homerun -Name[ca]=Homerun -Name[ca@valencia]=Homerun -Name[cs]=Homerun -Name[da]=Homerun -Name[de]=Homerun -Name[el]=Homerun -Name[es]=Homerun -Name[fi]=Homerun -Name[fr]=Homerun -Name[gl]=Homerun -Name[hu]=Homerun -Name[it]=Homerun -Name[ko]=Homerun -Name[nl]=Homerun -Name[pl]=Homerun -Name[pt]=Homerun -Name[pt_BR]=Homerun -Name[ro]=Homerun -Name[ru]=Homerun -Name[sk]=Homerun -Name[sl]=Homerun -Name[sv]=Homerun -Name[tr]=Homerun -Name[uk]=Homerun -Name[x-test]=xxHomerunxx -Name[zh_CN]=Homerun -Comment=An application launcher -Comment[bs]=Pokretač aplikacija -Comment[ca]=Un llançador d'aplicacions -Comment[ca@valencia]=Un llançador d'aplicacions -Comment[cs]=Spouštěč aplikací -Comment[da]=Programstarter -Comment[de]=Ein Anwendungsstarter -Comment[el]=Ένας εκτελεστής εφαρμογών -Comment[es]=Un lanzador de aplicaciones -Comment[et]=Rakenduste käivitaja -Comment[fi]=Sovelluskäynnistin -Comment[fr]=Un lanceur d'applications -Comment[gl]=Un lanzador de programas. -Comment[hu]=Egy alkalmazásindító -Comment[it]=Un avviatore di applicazioni -Comment[ko]=프로그램 실행기 -Comment[lt]=Programų leidiklis -Comment[mr]=अनुप्रयोग प्रक्षेपक -Comment[nl]=Een programmastarter -Comment[pa]=ਐਪਲੀਕੇਸ਼ਨ ਲਾਂਚਰ -Comment[pl]=Program uruchamiający -Comment[pt]=Um lançador de aplicações -Comment[pt_BR]=Um lançador de aplicativos -Comment[ro]=Lansator de aplicații -Comment[ru]=Запуск приложения -Comment[sk]=Spúšťač aplikácií -Comment[sl]=Zaganjalnik programov -Comment[sv]=Ett startprogram -Comment[tr]=Bir uygulama çalıştırıcı -Comment[uk]=Засіб для запуску програм -Comment[x-test]=xxAn application launcherxx -Comment[zh_CN]=一个应用程序启动器 - -Icon=homerun -Type=Service -X-KDE-ServiceTypes=Plasma/Containment - -#X-KDE-ParentApp=plasma-desktop -X-Plasma-API=declarativeappletscript -X-Plasma-MainScript=ui/main.qml -X-KDE-PluginInfo-Author=Homerun Developers -X-KDE-PluginInfo-Name=org.kde.homerun -X-KDE-PluginInfo-Version=@HOMERUN_VERSION@ -X-KDE-PluginInfo-Website=http://userbase.kde.org/Homerun -X-KDE-PluginInfo-Category=Application Launchers -X-KDE-PluginInfo-Depends= -X-KDE-PluginInfo-License=GPL v2+ -X-KDE-PluginInfo-EnabledByDefault=true -X-Plasma-DefaultSize=290,340 -X-Plasma-ContainmentCategories=desktop diff --git a/plasma/applets/homerun/fullscreen/viewer/CMakeLists.txt b/plasma/applets/homerun/fullscreen/viewer/CMakeLists.txt deleted file mode 100644 index 67892155..00000000 --- a/plasma/applets/homerun/fullscreen/viewer/CMakeLists.txt +++ /dev/null @@ -1,26 +0,0 @@ -set(homerunviewer_SRCS - ${PROJECT_SOURCE_DIR}/internal/aboutdata.cpp - fullview.cpp - main.cpp - ) - -include_directories( - ${PROJECT_SOURCE_DIR}/internal - ) - -qt4_add_dbus_adaptor(homerunviewer_SRCS org.kde.homerunviewer.xml - fullview.h FullView) - -add_executable(homerunviewer ${homerunviewer_SRCS}) - -target_link_libraries(homerunviewer - ${KDE4_KDEUI_LIBS} - ${KDE4_PLASMA_LIBS} - ${KDE4_KDECLARATIVE_LIBS} - ${QT_QTDECLARATIVE_LIBRARY} -) - - -install(TARGETS homerunviewer ${INSTALL_TARGETS_DEFAULT_ARGS}) - -install(FILES homerunviewer.desktop DESTINATION ${SERVICES_INSTALL_DIR}) diff --git a/plasma/applets/homerun/fullscreen/viewer/fullview.cpp b/plasma/applets/homerun/fullscreen/viewer/fullview.cpp deleted file mode 100644 index 7101d44d..00000000 --- a/plasma/applets/homerun/fullscreen/viewer/fullview.cpp +++ /dev/null @@ -1,249 +0,0 @@ -/* - * Copyright 2007 Frerich Raabe - * Copyright 2007 Aaron Seigo - * Copyright 2008 Aleix Pol - * Copyright (C) 2012 Shaun Reich - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "fullview.h" - -#include "homerunvieweradaptor.h" - -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -FullView::FullView() -: QDeclarativeView() -, m_backgroundSvg(new Plasma::FrameSvg(this)) -, m_lastFocusedItem(0) -, m_plainWindow(false) -{ - KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); - m_plainWindow = args->isSet("plain-window"); - - KDeclarative kdeclarative; - kdeclarative.setDeclarativeEngine(engine()); - kdeclarative.initialize(); - //binds things like kconfig and icons - kdeclarative.setupBindings(); - kdeclarative.setupQmlJsDebugger(); - - setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - setResizeMode(SizeRootObjectToView); - - if (!m_plainWindow) { - setWindowFlags(Qt::FramelessWindowHint); - } - setAttribute(Qt::WA_TranslucentBackground); - setAttribute(Qt::WA_NoSystemBackground); - setAutoFillBackground(false); - viewport()->setAutoFillBackground(false); - viewport()->setAttribute(Qt::WA_NoSystemBackground); -} - -bool FullView::init(QString *errorMessage) -{ - HomerunViewerAdaptor *adaptor = new HomerunViewerAdaptor(this); - qApp->setProperty("HomerunViewerAdaptor", QVariant::fromValue(adaptor)); - QDBusConnection dbus = QDBusConnection::sessionBus(); - dbus.registerObject("/HomerunViewer", this); - dbus.registerService("org.kde.homerunViewer"); - - // note: in libplasma2 this becomes simpler: - // Plasma::Package package = Plasma::PluginLoader::loadPackage("Plasma/Applet"); - // package.setPath("org.kde.homerun"); - // setSource(package.filePath("mainscript"); - Plasma::PackageStructure::Ptr structure = Plasma::Applet::packageStructure(); - const QString homerunPath = KGlobal::dirs()->locate("data", structure->defaultPackageRoot() + "/org.kde.homerun/"); - Plasma::Package package(homerunPath, structure); - setSource(package.filePath("mainscript")); - - if (!rootObject()) { - Q_FOREACH(const QDeclarativeError &error, errors()) { - *errorMessage += error.toString() + "\n"; - } - return false; - } - - connect(rootObject(), SIGNAL(closeRequested()), SLOT(hide())); - - setupBackground(); - - KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); - if (args->isSet("log-focused-item")) { - QTimer *timer = new QTimer(this); - timer->setInterval(200); - connect(timer, SIGNAL(timeout()), SLOT(logFocusedItem())); - timer->start(); - } - - return true; -} - -void FullView::setupBackground() -{ - m_backgroundSvg->setImagePath("dialogs/background"); - m_backgroundSvg->setEnabledBorders(Plasma::FrameSvg::NoBorder); -} - -void FullView::setConfigFileName(const QString &name) -{ - rootObject()->setProperty("configFileName", name); -} - -void FullView::focusOutEvent(QFocusEvent* event) -{ - event->accept(); - if (!QApplication::activeWindow()) { - resetAndHide(); - } -} - -FullView::~FullView() -{ -} - -void FullView::toggle(int screen, uint appletContainmentId, bool appletContainmentMutable, - int desktopContainmentId, bool desktopContainmentMutable) -{ - if (isVisible()) { - resetAndHide(); - } else { - if (!m_plainWindow) { - KWindowSystem::setState(winId(), NET::SkipTaskbar | NET::SkipPager | NET::KeepAbove); - Plasma::WindowEffects::overrideShadow(winId(), true); - } - - // Make sure the window will show on current desktop. Necessary after - // login. See https://bugs.kde.org/show_bug.cgi?id=312993 - KWindowSystem::setOnDesktop(winId(), KWindowSystem::currentDesktop()); - - QDesktopWidget w; - if(screen < 0) { - screen = w.screenNumber(QCursor::pos()); - } - QRect rect = w.availableGeometry(screen); - setGeometry(rect); - show(); - KWindowSystem::forceActiveWindow(winId()); - - qApp->setProperty("appletContainmentId", appletContainmentId); - qApp->setProperty("appletContainmentMutable", appletContainmentMutable); - qApp->setProperty("desktopContainmentId", desktopContainmentId); - qApp->setProperty("desktopContainmentMutable", desktopContainmentMutable); - } -} - -void FullView::resetAndHide() -{ - if (m_plainWindow) { - kWarning() << "ignored because we are running in plain window mode"; - return; - } - hide(); - QMetaObject::invokeMethod(rootObject(), "reset"); -} - -void FullView::keyPressEvent(QKeyEvent *event) -{ - if (event->key() == Qt::Key_Escape) { - resetAndHide(); - event->accept(); - } - - QDeclarativeView::keyPressEvent(event); -} - -void FullView::resizeEvent(QResizeEvent *event) -{ - QDeclarativeView::resizeEvent(event); - updateGeometry(); -} - -void FullView::updateGeometry() -{ - m_backgroundSvg->resizeFrame(size()); - if (Plasma::WindowEffects::isEffectAvailable(Plasma::WindowEffects::BlurBehind)) { - Plasma::WindowEffects::enableBlurBehind(winId(), true, m_backgroundSvg->mask()); - } -} - -void FullView::drawBackground(QPainter *painter, const QRectF &/*rect*/) -{ - m_backgroundSvg->paintFrame(painter); -} - -void FullView::logFocusedItem() -{ - QGraphicsItem *item = scene()->focusItem(); - if (item == m_lastFocusedItem) { - return; - } - - m_lastFocusedItem = item; - if (!item) { - kWarning() << "No focused item"; - return; - } - - QGraphicsObject *obj = qgraphicsitem_cast(item); - if (obj) { - QDebug out = kWarning() << obj; - - // Log values of interesting properties if they are defined - out.nospace(); - static const QList keys = QList() << "text" << "label"; - Q_FOREACH(const QByteArray &key, keys) { - QVariant value = obj->property(key); - if (value.isValid()) { - out.nospace() << ", " << qPrintable(key) << '=' << value.toString(); - } - } - - // Use qmlInfo to get file name and line number - qmlInfo(obj) << "<--- Focused Item"; - } else { - kWarning() << "Focused Item:" << m_lastFocusedItem << "(not a QGraphicsObject)"; - } -} - -#include "moc_fullview.cpp" diff --git a/plasma/applets/homerun/fullscreen/viewer/fullview.h b/plasma/applets/homerun/fullscreen/viewer/fullview.h deleted file mode 100644 index b03948f0..00000000 --- a/plasma/applets/homerun/fullscreen/viewer/fullview.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright 2007 Aaron Seigo - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef FULLVIEW_H -#define FULLVIEW_H - -#include - -namespace Plasma { -class FrameSvg; -} - -class FullView : public QDeclarativeView -{ - Q_OBJECT - Q_CLASSINFO("D-Bus Interface", "org.kde.homerunViewer") - -public: - FullView(); - ~FullView(); - - bool init(QString *error); - - void setConfigFileName(const QString &name); - -public Q_SLOTS: - /** - * If the view is not visible, show it in @p screen. If @p screen is -1 - * the used screen will be the one that contains the mouse - * - * If it is visible, then hide the view. - */ - void toggle(int screen, uint appletContainmentId, bool appletContainmentMutable, - int desktopContainmentId, bool desktopContainmentMutable); - void updateGeometry(); - -protected: - virtual void focusOutEvent(QFocusEvent *event); - virtual void keyPressEvent(QKeyEvent *event); - virtual void resizeEvent(QResizeEvent *event); - virtual void drawBackground(QPainter *painter, const QRectF&rect); - -private Q_SLOTS: - void logFocusedItem(); - -private: - void setupBackground(); - void resetAndHide(); - - Plasma::FrameSvg *m_backgroundSvg; - - QGraphicsItem *m_lastFocusedItem; - - bool m_plainWindow; -}; - -#endif - diff --git a/plasma/applets/homerun/fullscreen/viewer/homerunviewer.desktop b/plasma/applets/homerun/fullscreen/viewer/homerunviewer.desktop deleted file mode 100644 index 0afec257..00000000 --- a/plasma/applets/homerun/fullscreen/viewer/homerunviewer.desktop +++ /dev/null @@ -1,73 +0,0 @@ -[Desktop Entry] -Type=Service -Icon=kde -X-KDE-ServiceTypes= -X-DBUS-StartupType=Unique -X-KDE-StartupNotify=false -Exec=homerunviewer - -Name=KDE Homerun application -Name[bs]=KDE Homerun aplikacija -Name[ca]=Aplicació Homerun pel KDE -Name[ca@valencia]=Aplicació Homerun pel KDE -Name[cs]=Aplikace KDE Homerun -Name[da]=KDE Homerun-program -Name[de]=KDE-Homerun-Anwendung -Name[el]=Εφαρμογή KDE Homerun -Name[es]=Aplicación Homerun de KDE -Name[et]=KDE Homeruni rakendus -Name[fi]=KDE Homerun -sovellus -Name[fr]=Application Homerun pour KDE -Name[gl]=Aplicativo de KDE Homerun -Name[hu]=KDE Homerun alkalmazás -Name[it]=Applicazione Homerun di KDE -Name[ko]=KDE Homerun 프로그램 -Name[lt]=KDE Homerun programa -Name[mr]=केडीई होमरन अनुप्रयोग -Name[nl]=Toepassing KDE Homerun -Name[pa]=ਕੇਡੀਈ ਹੋਮਰਨ ਐਪਲੀਕੇਸ਼ਨ -Name[pl]=Aplikacja Homerun KDE -Name[pt]=Aplicação Homerun do KDE -Name[pt_BR]=Aplicativo Homerun do KDE -Name[ro]=Aplicație KDE Homerun -Name[ru]=Приложение KDE Homerun -Name[sk]=Aplikácia KDE Homerun -Name[sl]=Program Homerun za KDE -Name[sv]=KDE Homerun-program -Name[tr]=KDE Homerun uygulaması -Name[uk]=Програма KDE Homerun -Name[x-test]=xxKDE Homerun applicationxx -Name[zh_CN]=KDE Homerun 应用程序 - -Comment=Displays KDE Homerun in a popup -Comment[bs]=Prikazuje KDE Homerun u iskočnom meniju -Comment[ca]=Mostra el Homerun per a KDE en una finestra emergent -Comment[ca@valencia]=Mostra el Homerun per a KDE en una finestra emergent -Comment[cs]=Zobrazuje KDE Homerun ve vyskakovacím okně -Comment[da]=Viser KDE Homerun i en pop-op -Comment[de]=Zeigt Homerun in einem Fenster an -Comment[el]=Εμφάνιση του KDE Homerun σε αναδυόμενο -Comment[es]=Muestra KDE Homerun en una ventana emergente -Comment[et]=KDE Homeruni näitamine hüpikdialoogina -Comment[fi]=Näyttää KDE Homerunin ponnahdusikkunassa -Comment[fr]=Affiche Homerun pour KDE dans une fenêtre qui apparaît -Comment[gl]=Mostra o Homerun de KDE nun menú emerxente -Comment[hu]=Megjeleníti a KDE Homerunt felugró ablakban -Comment[it]=Visualizza Homerun di KDE in una finestra a comparsa -Comment[ko]=KDE Homerun을 팝업으로 표시합니다 -Comment[lt]=Rodyti KDE Homerun kaip iškylantį langą -Comment[mr]=केडीई होमरन पॉपअप मध्ये दर्शवितो -Comment[nl]=Toont KDE Homerun in een pop-up -Comment[pa]=ਪੋਪਅੱਪ ਵਿੱਚ ਕੇਡੀਈ ਹੋਮਰਨ ਵੇਖਾਉਂਦਾ ਹੈ -Comment[pl]=Wyświetla KDE Homerun w oknie wyskakującym -Comment[pt]=Mostra o Homerun do KDE numa janela -Comment[pt_BR]=Exibe o Homerun do KDE em um menu de contexto -Comment[ro]=Afișează KDE Homerun într-o fereastră-balon -Comment[ru]=Отображает KDE Homerun во всплывающем окне -Comment[sk]=Zobrazí KDE Homerun v popupe -Comment[sl]=Prikaže KDE Homerun v pojavnem oknu -Comment[sv]=Visar KDE Homerun i ett meddelandefönster -Comment[tr]=KDE Homerun'ı bir açılı pencerede görüntüler -Comment[uk]=Показує контекстну панель KDE Homerun -Comment[x-test]=xxDisplays KDE Homerun in a popupxx -Comment[zh_CN]=在弹出窗口中显示 KDE Homerun diff --git a/plasma/applets/homerun/fullscreen/viewer/main.cpp b/plasma/applets/homerun/fullscreen/viewer/main.cpp deleted file mode 100644 index 26212ac2..00000000 --- a/plasma/applets/homerun/fullscreen/viewer/main.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 2 of -the License or (at your option) version 3 or any later version -accepted by the membership of KDE e.V. (or its successor approved -by the membership of KDE e.V.), which shall act as a proxy -defined in Section 14 of version 3 of the license. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ -// KDE -#include -#include -#include -#include -#include -#include -#include -#include - -// Qt -#include - -// Local -#include -#include -#include - -static void showError(const QString &errorMessage, const QString &email) -{ - int ret = KMessageBox::warningContinueCancel(0, - i18n("

Sorry, Homerun failed to load

" - "

Do you want to report this error?

" - "

If you decide to report it, please copy and paste the following output in your report:

" - "
%1
", - errorMessage - ), - QString(), // caption - KGuiItem(i18n("Report Error")), - KStandardGuiItem::close() - ); - if (ret != KMessageBox::Continue) { - return; - } - KToolInvocation::invokeBrowser(email); -} - -int main(int argc, char *argv[]) -{ - QScopedPointer aboutData(HomerunInternal::createAboutData()); - - // Define cmdline options - KCmdLineArgs::init(argc, argv, aboutData.data()); - KCmdLineOptions options; - options.add("log-focused-item", ki18n("Log focused item (for debug purposes)")); - options.add("plain-window", ki18n("Use a plain window (for debug purposes)")); - KCmdLineArgs::addCmdLineOptions(options); - KUniqueApplication::addCmdLineOptions(); - - // Create app - if (!KUniqueApplication::start()) { - kError() << "Already running."; - return 0; - } - - KUniqueApplication app; - app.disableSessionManagement(); - - // Create view - KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); - KCmdLineArgs *kdeArgs = KCmdLineArgs::parsedArgs("kde"); - - if (!args->isSet("plain-window")) { - app.setQuitOnLastWindowClosed(false); - } - - FullView view; - - QString errorMessage; - if (!view.init(&errorMessage)) { - if (args->isSet("show")) { - showError(errorMessage, aboutData->bugAddress()); - } - return 1; - } - - view.setConfigFileName( - kdeArgs->isSet("config") - ? kdeArgs->getOption("config") - : "homerunrc"); - - return app.exec(); -} diff --git a/plasma/applets/homerun/fullscreen/viewer/org.kde.homerunviewer.xml b/plasma/applets/homerun/fullscreen/viewer/org.kde.homerunviewer.xml deleted file mode 100644 index 17748c17..00000000 --- a/plasma/applets/homerun/fullscreen/viewer/org.kde.homerunviewer.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/plasma/applets/homerun/homerun_config.h.in b/plasma/applets/homerun/homerun_config.h.in deleted file mode 100644 index c1802c53..00000000 --- a/plasma/applets/homerun/homerun_config.h.in +++ /dev/null @@ -1 +0,0 @@ -#define HOMERUN_VERSION "@HOMERUN_VERSION@" diff --git a/plasma/applets/homerun/icons/CMakeLists.txt b/plasma/applets/homerun/icons/CMakeLists.txt deleted file mode 100644 index 02e3c9ec..00000000 --- a/plasma/applets/homerun/icons/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -kde4_install_icons(${ICON_INSTALL_DIR}) diff --git a/plasma/applets/homerun/icons/hi128-apps-homerun.png b/plasma/applets/homerun/icons/hi128-apps-homerun.png deleted file mode 100644 index 6b0e1c1c5d1bd1f2f4f95bf2330c3b9fee1d3126..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 11697 zcmV;iEl$#jP)N;mG#kq^Bv1)Fb zRR%ndLrY`hr|v4)@fZK2yrOBBd3>NN6!dzO_lTDzz{&+*2b{+6rSCm=eQ9<5-)Z&w z22l`wKJVm9hyV1epS}Og4+ro)VH^=0!et4ta=@qaG~h6Q@t>ak?3#v6KhPVDTX~+h zX*3#_G0(KCXia@}Bnrm|T0i!#CUu}$Mc`ZSdf?wbTeV@^gF2ngo%}w%(YUU-X8oE# zAaG*n?D1(?0<3rvXjTjOciz8$U(Mzn59oCIlDXb*$TQWs>o!*U{r=;_?I%_R2{fw( z{MyYs|DR5;FJ9>XjCp1xK~tsA=Q}>!(Y)eGpjjp0-=7BfDoJ3jb+2tgNq{71U)dzk ztYq*%FN3ew8;ZqQVSsrYB922zV5%ia;9udAK(n&J--R>ZP@EcgE(IY}kC6lhBEi~C zE7~T|tZeW}>}QCTsQyry1a&Ky1e%oz{!TXYMNy=gOh5vpIYfLvC_@$nF?Fy4NuXIt z;NNi{g1h!?z{2~!b`Y)6O`HsT9 z*ZtS8;49)i%`gA59e)>h_uY5%KmPHLLmeF*V$wg0sXyrAy4V-wM*7*~@t6_Fbr^ni zMj{ahUSB)L=IwaQf%g=rx8tz_jM?Yoy%mQUhe;Os2ARN`_=$*s{{!!y=!7RO#o5B8s9C1d=MJ%1HH2XIGs^>0aXnC*nsD) zfB00bHQ!>o5}(s|&|xop@$!V`s@D!+#9a}gUJj$$0w=u6jxnLd>#!4 zVEXI_;2S&xrqV_*)$Tx#KgqO z-rnBR$BrHA`u*>JKXUNkL9a?mh|4V{E~pKF7llUxWSxY##t-4Z4EW9+gJ@YLXe{f2 z=NJAOQ6=?-Pyqa0haot8mKh|0!4|Y7I55?0NAExj+bS$@Ww`~S(a0=fCrKzB5}^o* zS!6UCuXH#ZVognrZ};xq!(aaLmpgG1oE{k&If?c|+dJ>P)BEhR&raZTKS((VIVZ#g zB>>KhoJk;>eL~m|zV0JnvRFV{Se1qfkm3dc&U}COM+km9+7xI&k`aksMPRU%y=%j^ z-Eh-7JAM{<8)910js~ha5#w|c^N>S2n&|b2;5R<0<#XMXhe+J7NVHh1f}=W=P5Yg=QuG>!HJS$v(09^ zqpGUPzjNo#(JQXF;@|e~-~TwiX9`Cs+mb-L0`UbIZ+8?s7ml5}74&7DI%&R0onF4{Zgw_uhLc zSAf= z@Hi-_6qUw}S8s#Y(4Yfkl=RvYqRWn~;dOI2kLsLy9+;H`d zR7T#MzhyB*Ak~HLvGCAC4|Tlo!V6t^Xbi`6E@uCVApn;Y^XHfZ(5WPVg z>8A%Dee}^!@X%=--8ej#36KWxsux)FPpi*E34q~X1I7VRtj2tE1SRYl0v^SCG~mUh zgDB|CHg;T@;nM7ng4xW&o@=&((`H4ZFPiZz&x8aR0fo2Tddu_RgAX1>DL@1`g<}wh z4|0^Iu3d59D>F$WNdQss!s}0v^RfCvf!0)_-J0#sP8^V~iPrTD<{uhCGP?%m(0MBw!{L z8i(o#kf@RX6yRwrbHJ9`a>ajN(oCQ4bu#)eY#haz-*)KGp^xy;aU7kw6#W+k0Tyd5 zbMvnAb4d~)j}0P#;w5kj0g``<828W1oO-x=eI-x;Q4qwme^;g?U;!)q0@V5Eo_XdO z0{<9}GdRxU2ttl4lrAU%P|xw%7X1ndm>Z}gPr%4*0h(nA5+H@-P(;5~%fU4bML|B`1z+(32ylw#Y49Smh#*P;3Ib6KK!b8UdGPY_ z#u5wEI`dfIXYp!i{`b&vn)w*)2_yJtT3cI>$>5XAH<@d_e<2CLz&Gl3Mx3Gco+)vC zR1kH!@CKL^Aa{^c0j+wjRSh~uIYZ?II@nlZl7c{KemA#>yh9>eAQ*)2|LY^cS6+Xs zOXcrRKn~*l7YhMm37iJ4CV$_(Pkwefzv}N$!)mxCfIQb1@k|Qf7qY?4JIK(pkDg}0joa_x zw1y%s%QIi41yr*iRD+|Xw*>HwXbEjDwLk$HeWH}vlkx0MmjtBu-+J#LJo(&$plg$X zSMGTg2`C{X!Ty(*gVFYfdRHE}tvZON@b|N2_|a=*hqQNe!VmuK3D6W2LrHBTrmU4? zAj*EzHDCOCSfexE)B4KO?ef3mWc`1+B|rlBpSka;ePtVW+(&u)JhyP#e#W9d7U@$| zfIRy-S=aN4_5h`IRTSu<#%WC3#ameNaC7Q?4EDhH{`p}T932C9-FmQ>t^uR906i5Q zm+vgvyW_5}JlL@3uj(j71=0#2e<@3V1n~dt-u?S3Hc3Sr9H*?=XRZL!B}Lp0h?78( zHOfrQN0Hx9WWpaQrj^;V*np25?17&?u^)~!w}HE=7OW`jO%^K#s|+~J(F8?f$ZB`( z-TsBI(yzSd%rZ#=emTIu?VkPnDmO`mn(-nm{2THEJM%1v{^YNh#DB6K5ZC*8Nd5K2 zCe;62M&PF_4b-oZ=zsA~2jKZXz6wQEYr$1jFRd(&bpt0xCX5X}8cC7}Mn&>h&DL`@qIaLfmp8aL0_ucvWSr&h)v6SDSrOcj@ zQTV}6eg;9U8Oqi*fy2E9i&Y$Kfl8B?k1LXsEK@0w1i&Q0Rd;^n!F4$%0iP@I_Y(Lt z^L1FL$*E>Ord;`n^|V-{Gi2mDXL@3a1klPZAc5~RX`sq(Oq+J;k|9-6N+1-1A3yda zbPRc*vSACjDr>>waAAT9u1?~)Q`QoX8B1a8QRweGiHp7=dBIBh1hYeu1i2&upIh){ zu`gc`0^iqn3e&7Lz~cf9hauXfRPfH75F)!>vNs@E{FsZa~UZ(;d*DKgPW-W!LM!}E8EMhds&O#yqaAvd# zwjl}D=0Fl?vkCq!-`c;g48hmPJ$X2JZ9XzJ1c7tMSyqlD`gGFZwX*_2>5BgaMRH69 zkOUAh(4z;tNw;L9Zy`63!0+nrfro$gBTCM3)aw8X{Z-c>E2#7Vo2Y z4Wd}RjCqH2JvhAyf|#ln!PgBHTL2@a^7n8G3FvCwbM}>AX3a(9vjzUA2z*)R%b8Wu zFPt0%Z`a2xzm7xjDFutoemY@IcH0xENx{oTAk8C(Ned-t^nobkA^N;PR0`mA&V zK1#6X7r*=!eA3zp*r^0cs_MXMcY?+c3-+*H1w;a#U4sZygR$!oBZL9`=X+Ra+FX4l zqGV7cB_qMsJEdSz`>RV27V%33|7HZgv}xD<8Umm4=_I8Op@{*QI(rbJ80;Y(M__a8 z#I^EC4edb+sYl3X%#{t(eJs5w?LoNzlMCOC@u(7rR99GjTy}#HH^n7~1`Q$11 z*;CJe1LOOZsP~;E80;}yn8zcEoFvHOJ%^b3ldg*ESj;Bad((CEzBgNXfAsu$`0fuLhN%b-Yd3Gl zSpQlu7dV*Yqpo8_8_Fvcm~F(x?*%Cbkqs(86QmNfD7%luMhFc60q|e0$ z*XCMhZBu11;6FamxwxK1n#F*BV+!!uOhC(Pjd2Dh2Rk5$m9qqRd>B~ZM=K99c${V< zY%0y4lK_h)gdWMYxoHCyb(m9T;bzPDqsQ192LAQY$KZHd57ckj4&}JYhbwz58I_ft z#Q=|k&xUMYFtBk%V+4>ur{_^DYNf|i+*(~)$U@085ncre+SS;?jz|y+_>csdcQn;x z3jPhU*e7dWwNlRX8%bK;Y=^q?V!$3c5Eek5^+pMNy#&5S_JbW30}{ZRbpqJ!cEDx~ z8H1l`5(v%y=YIDByzufHP`hy}TK${AUR;X79uw2^1i0c62}whgNx*6kRWm=zz*mMu zfcpA+a5e6R0iPD4v2%*`Ee6EwzdWe>vuxO z6vk5o$&L`!1dw7yOcFRq68JNd1e$cgzn+0Fi+wQ`u1oT{T#JoQNl8xskbBtVcq(O9IV8;9ra2mu#f)u0GavJNDHam)K`J zMhGbc8^j+jYV)AF#0E1yKZK&38~{SM6|GqtW@T(f36N_7EEW9Zyue>P{S3VQ;m5Fk z%T-X_uo3JoH>*Je)=MZ3ZgdX)uO0&7VXv`<9wnu#$@E2?`ICfWhg zYofIJqLpldif|f|K$|Lru7JP$A7${FpPwx1Rjtl}mt$o!60lS&e<7pq6%6*g`0{H|)6fJ}>(+y#$PI?PJl05x zr1V_P|56%^ zugx7X)TW3GQfjj4nr}S$XT=CUPqBU3$_J1NB?;UR>iIx0!bT8BC=_KS)X}H}D#hY; zxD-cY0)sMB79Erox}a|q*S>>M{1S;Q0C3T4UN>J|AAx`B^l8lN`vnW~)Z)x9a+hO) zv4sU~A|k+i{YK||u1M20B@W252jBW*_zLaPz721CWD;rpbJ#t z!jLs~H0>MOlap;Vv*>+`<4|GWal$8d*>Zq+qteR&=AKy#80- zzB2(x>`EFVfO=b1^Wea!ZQ41`3-Yf}(v;L-rxTA?pNYJz4W4N)gvZA*>CJUX;ZLAp zS5vrS-|g_rKfD6tW1}pmUrzxaP7~`dtPcFdpCb&UZ`iSH!tEd#1;HFWEF8;}aVaGh58(5243}sv1WyEU9T<*Xf?%NGGRS zHRMvMfS8@{JM;FKx4h|t{B8f`R&*@2ATHEQefA4+rb_Q(y?4htS<@!oXoXl$o(nXa zlkEWYvH5-%kzoDW8t5Ayg~M&#tow+?p<&CnO6V6LwZ0Zp$Vj%U4dqB$3RxnEhJ5~l zvN*b&(x6@<3mMsDe~}R$3`&ML*=O`PtQg^pj*`d@pYIx&eD8^m=CVDL2|&gHrJ;By z-ufw~@kELXuKfHJxa_1!M`0%rg3SWSGN767!&YphH??}RY&_-;{KYnFobP{rP0LV!RH2@Ke9NCG_^7GglFC5&|7rp#1f@67 zCI@3;G~7S&&f|wgA!@Yk_(CJb88w+$ZOR8yLP&6^McM)c^Wa6f|DM!`Zy`~#cz<2` zd@*Md#FS@*Pv5Wu9{tS$=;`PNdkOXv!j5E=`9r{yhb!HS3C}627mkXt5kj#a@cSU( z!y*yi4EVhv@OwT6jcpjjf(k|yQ6)aaWFw4AvFAOlQVzCxMqhsDV6gub^&1)isqut* zuY#13z{GZ&qM!-(HHR>KmuD<(aALX=pYSGb_D+19+O3KNAlTcC;@^+mI;~R24wewA zWmz(AOx3z>okLER$WBC0DZ*5mMQ0-#n2Jbr%$9EflR*a`HDi$rCTsAx=*0*Sm4FUK zq}fWdIEXVifG%W!-K!o4(97}%*a!xK5DJEHmZL5|-^-$H)TaJC`|f=B|Rfk>d$@e2}wwO{pPgXT{lGBd&S zz5>36nm5TVR0$H``g&*D1W1Pz1p3?WzK5B)=U{DJZ9>joHY0~hJGs*0LbT#NaJr)p zt9>vi#F9XGDa;#F0m={)?**wHT_hYrHGl(i3nJLImY(BY3J^dN(6YJ4Y)@17VVhY3 z|D}fx$>39edulf~C`*7KBsHN(&Lb04YG4$kMulyt4q80#@BeV}!(X+EA%AqCXZJxD`{Jr;%B6utU!CjI(%FTx-iYOF=5 zso&r%@ju^cpdtk#@*uRt07?RmB!OF!1S!-J6ZhVZ4*U;H7!+dI4Aox`7i$!dqjb=B-xD$9Sq&rR1Lq+1?l{kmN?IDGsxp!X%Y zg`6f)3edf%JeHnQ*Ks!cl@SUi3?Ui71W75vyx>#(zaON&L&^>$ zLb}VrqAFyVk_1M#WD}?_8>NI5_=DTkk+Xmk#lJ)Vd;v<405>)k0S{u zHtfQ2yrl!QRwuZe4k&RJEJ%Q*8ih`K0bm9?965nWoK*RQOTz*Jqlo&50=(?Xv11X6 zu!h)RpodiiK+j1)wICu1D8JIo`M~b3hJdI|A@=75-v{#~i)!Z~fZ`G+zJO^;6YuY5 zkL|neYEXLzB+?vZwU8Gchm*}Gq(lcf$w67`jz*+oTtpIenfmJ)xB{%Q=2+(llomOl zu)xIJuceY;F3CWu?fUIa&~|PJ-a35_L=C3DnF^2u+L*YHyMxN2nmPk0o)AL!)WDj0 z6^r=Ti79SPSMG*>5%<;#3M%4bx3R&+gFl}HNJ|osVW{>F=*?3h4i`!=lf@{&=;#Rh z3YztjB#`>`@p4T-slx;}Z!DQp0xaejlK^Ks;poXWmZf8~I#{5j(p4aD0V6KS@SE>A zom*{1F`Q^=gW(AuYg8@r+PD#@b_=7@?59~DmS;V?4`Q?wgJ!gQ3B^ww=xJ=e`eqp9 zO289{Cd~YRJo5vK1V0@Dq)!6bCZO9S$_-aZIXI0Xrc94W?hLtqGWbjd;0csD%;Z`Y5D)&Kl`jEL;y=J1heHzh5$qut4H5We*tGKowBlSaF%wbkXN_WiaOvQuOMp~H zVQQN|b`ixG2};3k5aB%L&Bsfkw2TOJ5~WChTQ-$}dSln6+5t=gw0B@Ho-3(U(D~4Yn z27VYNKm-kGDrniX{aP3hoZ#_E;EO7qKav{!an)i^S}s;5D>6!qU_lZn|KLH#!&U4? zb$}!o80>1utS6Togm&lr2TGKCBpg!GJ6YBm!VUC)lxIrs>LE&@VV* z;HwS3kw4Bm^V0@DQvxJJc+-&tj08au3SGsF1moiq40u)+j%QWo#I0DaSi{=2WrF~U z9zJun0}i7#P6RO9q-0I9IXp9{S25js4JKb?!}6c+H6mFZlHj8gEigP4KvjT7DE@}1 zZ21%533{Iff?t5C@*A(%4*gME>Y1NK@E1dXv|U7Akp!Yd0;j78NdSxlQf!ll3QP>S zZCmxC2r$=iB0wt=;1CkP$q3+NY3M9n3T4gE_%x=YV@i6yX-QkWE%X}Q7oZp~wwvMI zk4|C+l$N!{AuouzezMMw$YP&netw=F8nMpOh~;0JvOz7EzmZGrx9{w(n4(fLaPe<=h=&pS{^ zAYYeBBtcaB*a54f&MHs+B)02K$ zKMz2yyC9=Q$i+&G`YJbzPPTRrvfvoYo+dkhf$s+^g5R*A3Hn0TSvsF){xE^xpMCI` zN`TBrpm+zE4eG?K8k+%2o;3p8zOx}M0;Ed}MFku@*2-G4<;esP**d+vevTJ*aNLV^ z2^5R4EO|X(A%hUx8!UEkXpa7p;MEJ0LnrP0|0;V!1*btEw+N$ zs9RF*z(N5c`rblYKH42dc;n#5m{}~<0a{IZSl7@9y#X^!q_FmL4Su!=FfR%GbC7@} zK~=F0Zf-2Z${=ykB0m)YNCLcfln79TDb7w7gi`YB1SQcDFY*+sg6SC_tS`5-N~UZZ zgvsx#!E&#eDG$7Vv>B|pqxo8_E$9uJaptQRSfwT1p=AI+n*^9QSmaM(7*aIMY1YDR zO|FDEz*40ElK^M~y!S~9*h&-v=wsEm>O@Uos$d2zXd_k?Sr@efcqXsW((#76O4c$y z#OJ{%=fr>+$M!Xrk}IT{FN3e_9=7NpPg+YRStbBU0P1u|yI+i`^9jb@+yCJN<`W2V zK7o=wn{9C$x4DU0YI|MpH+ zEIu+c$ol_CnV}pD@2Y10nRJ(QFBS=~V6Z4A32^NIrzKx*)5GnXisqC6nMwgg0-Qz( z@b{!ai=foIPuNoHNS^+hzeCwmr z5Y-sidO>ic19krQmqqO7ngD6p1bS2l6;3mM`zBY$1eiAxh_jefz}t9ntuX>9Mxf-I z$Fg(f~l3s7HbOBvtKrb?j4^;IQUTrvhn+xn@U-qh%;KRO&3XgRi=;L}Z; zLjug1Pk`!xH9Qcj{(HkhB%EvccD`j@r707s0E)fyc+ZRKz8b0ra++GZ8=?8sBZ2>X`jOLur=NhQ1kR4-0zca}z&gU|Bt6Mz@u z$Eda+WA&$og7AkU=OEp#1xtw^Q0DK}EnD)w_s~OC1qB7XZ0OBEVi5;i$^@8?1ZNx$ z$2nZS6|-SnCBIi%bqizP0vg!AAVP!6r^qXiBtl4jtVjr=VicEc|9E@|jP;S7jx87QF|NZxG!>8CZ5p-(hlt+Zj^JOtG%4WC2+6y6bS`v6EdhMq*#ik-$NhtJ zB9>syOtXp}^=q_7KQ$A8M_xDx9Rp(vk{}x^iX;iHyY9N(_uY5jXYgsIY!hg6NrDU3 zrGYL;Fc_?{TCHEe=-8rm5T7d{=O2ouMi>N#*ik(ngS^@bM zBY4KguocdXT$dM&6={$v7#Z`x1lImtzjZC^K%R@}V1iMm)oRwQTUR-Vx8~;NL6tiw zt`rFnyXp0MVW}jV(+eOK5FqhC4MCdWGtzy~Hw|T2#$|Gr!l~gP^!sq@*lLUz@>r=m zGZlM}bnj(k_>Xsv!LzR(N~ku@#3sn(MpD4(bQXT&8{fEV!-fr;@sLZl2ly370G{Ww zB1vW+6QqKRfF%9{zG(?u-xSXLLNFIqL;F~SHDDN>4ncpw1a)h1H&3)j{oYAQCCo_w z6GC<1#ZIUH^6&o%$6C9XD#*4ckjfrtXlQ8s&Ue0ZhrwW|$)zf|pajUKI!TVTGYLTY zpMXbD3H-{k60nvxz}fLA>t~F48B&fQkpOe?>Njj+Tgm%zA3sSNOfhK?MSGyLcL2Wo z)8Bx{>r0EcOHD9A^~UYlv*#u>3U9-d*{dLQ;&e>F7KxG}02S@NtW&}m@QQXCi<@PG2j zC!?>v`f3k?e->{os18o40z;Pxu#i{4#X6Mo?D4vW4N$bnTI2j6iyu-mzAQN4(i_BCkmi9vGU>gpSz zu<=^xoaPh4x$}NLUF{i^y5=|uCNPDa(%Cm(dn-1-c46(|6g>HM2mHgQ*Qbq%8g#6c z3?k^~5%6;ed{;|LOE+#k)1L%5MN4U6C@8yu(N#qNrOr>iX@kJ}7KcT&%7wA1#gF>35HfjRnxJAA94CH+oUTcbzc#(hy6L&zi$O=YllcPaEBG#-2| zZTY5!X>=cc_}n`)jfK~1i(G|;yNi%&?23_69 zSAZ3^8aUT2h!?JVa&l52YZteB3wL&Q&UANoPvY|lw1g*6M`9B$&osU-AYT}Y8d7y9 zZc9H@k)L1QXuIl;8tg$xWyfsKy)gu6JgfuhIlrVUIga`I6Mnhzq^eLeGS=;R(g zxYVb|E$BZibj1>?beoHdi-%r%>7~86nCCul;6UGRfBW0>hYuefLh0470)0#cdf-BX zeo+uW_5B1WH4iq+5-BQQpb*5@#FdMsG(5(w#-I?#8XW7e;H1H^`>%J}cHY&%XV}p+ zvtK)_M4M8#yPKMtBG{bLh*C=l){xsqXCADN02d}sARq|>VkE?CZEh<{0*x37 zL<8qO85w`=;lshf7TRW|4YJUI^HRBSuySw8Mwo0Tbdb`kso0_xXMBy$R#vICmpjC; zFBBT-7!-mt-5}NG(;hnmD_QKX76PbApe#7i0#Yds+L@8+@08U?0-NIZv}`*J@t!;@ z8vNBjfMgO7;FM$U0BK3tC=Vd5M2%6 zuOe>JH18?M=5`O&nv32X#pFe(-mX=y1H~;_tpIb=WII_58--oO%PqlrLQ+Iz& z+WeADl5Xr)oCduHJY%Z_(-R z-@kwR_U*^_?^};w?OK2O&HGOuKYo1q^5x2vD}j~*Wr6teakP2U#gw^+BWE9vn13#A-m#c@$Af2|Hm~38KI3xmlAAV7o22}!lnOWNRd1II zCq+1z8>g{J9lnx+PXcseu+!<%2Veq?%lIz%9JS~At7LWAVSbFTRv}te9k&y#|#-Z zsIY)_ynt0KkW;(iTJ47GzkdEacIJHR@_oJQj-I}JkK&fXhUw!!W<=?-5z`)sX z_(IdR8)>t5dC#~|wEW!54_|-(`t|4c@4tWl0^{iNt^4zi-042@GH>mb*j2YxEB1!; z?SJ+bWXRXAUw{Ap4OH{|&4)RM?-y;j=QHt;W%o(X`qfWffBf_3_mx`@ZajSXA85_r zzlX0r37K?ED{JASmmmKA{(bDyor&A8zxwzc=(g`aesrxq@#puiy{E5-PCPt$=dG{b zegNI@^yS;1KYy&>eaxhAsd>qYWjjv%{Q2|imoMs-`&7&K3iH}-0tQM+Nsu2f^$`H- zDn_S|XbaWNzka4AN}o;n$-gba4)1=a8l63&ZFu&mmhS1pYEBPtTQG+|x#!Qs9P#9? zKOg}lhnEV-Z^P@tDqXy~^!nZ2;U zK+)@*qh*KZPK{=xdF~2NbvQM%7;ME-%G4*vxUg3wa{4Wknm1vNI;YEAwOFqEDjzN^ zI)8VLZf=}rZGzj>Ne7Mh6q+|au;;6rSCg2vt*l=9{eA6LgBaPlb>V4Kn`Tb-JU7EI piAT`SL#pU=>4X41IfnVwsq4(MUhYUx@DV-8Cga<9}6ffU}l0-)(+<@(`7oG=-d|Bw2D(f z5utV|$V*yAc~nGEhC)ZNb+oQ6I(cLj0T}{)L;LOAi#QjF(|M9F_a^85f9L=BPA(z; zu>v?DB;|ZJ*>vKf|HjM<6L!c9#KY5zJk=UM@ddKI_!?Q8rkK8?#89w9ra#F)SQ@xR z@+SxOi+ZkH=%PrQp3(VAS7#7sBH|Aw|}R6sZ#XMfqqm-G;;AVD{ZK0SnE% zkjv#xijR*U8$9pT*H|$9cpn3`+wBxQfQ;fQq@8I-)_EQD?VX@iv3m@>_2$i1 zX}E{CxA())asHFZW~qUEkgAxjY3sRYw~v4a1_qE@twPancc8sxhI43$1rJf(?&`*# ztkYNKuipJ4@3R98``=Js{{SK=G?3Us)tpaHY2;PS9dJ5EG8!BlgsfJLtENFXoI@C< z;2|nn6;76%#kx#|EAiCTQ_%-116PTg{&9=%a{**ku8u4}SjAZ_Zj^s=T!AX}bqaRe z1DjEIMF+Fp375--;o)JbA=D_<_(rP2)&eCGj#au>iB)-#!t%fsCzLdC3jZ)iN0y~3 zIPv*LIX_2*#A9+)U%SPE8QJX)^wV}QP)2UI8~T<%kY1+5;rcFoRc1uO5g8J4)b5qJ z`n*LcC4te$DLjlXocvz8x_EKsHSp4#5u4G7QniWp&@s|WTJ|WESr&^0h1K=QRd?Zt zvIjfQwqw)JMtme~!^)yo_cBql_@%fcfAahr(LpoT=c$5{FC!$m4hwcwp`gC)K6q4a z_ei!(D;fQGf(>~7DJR1}qL7AST z#_;lcWl7XbL6-jIjS^&^xyph^hbJzt$M1jk!F_LdF4r*HJA1J%y8*9nlVbJ;31%c@ zXvT-U!+qFu_u#Vx0TQA6 z_jPkPzs9!7H-=;89Hj0NU-7Sl7s|~)+~mYv?-20In47zXa)_b2bKG4oeny?dE2ECt zA6;aty~31hyvytVYyOdaFh}3aPJMsOJ-$~)y@a3H04mS)I>sTY$WGgE9rxp(3u0(! zh>F|S*QdiU%m=-_y=!}zZp)JDhLGdgkHj7s_3$F*O1Y=iGLEsO`x_dYmekbLydw|@ z)aX1$Mn*p#U~q77p;RiZB7NWBXd5QN=?lqlyI2ChoM!l4Yl3IOT{wOdkC?)`fqt>1 zQ!EzO67a07@ut zEka0g0UkYRflMZ2|EE%pC99V>Iy!ojDK)rU?$iOgnI29{YnwiS=ukBuB8o}NL1<1j zqKcbYRWyoNbGmveb{y$R?u-N-KORS>n>$xibL!@wxSr(9TDwm@$?DOm~=hp+wStg_}V{iprZ%#9C(asF)O zq`p16jQ`d3I!R~GfQtF(3X`&LLQvL>lE!`vNM#t76M!*M0Qx(>uoyePID^jNvu;b9Dq zi2^7T!}z|o9F00rpk9bosJHK!pa{nh+JJZTpZGsU(G81$7de6XbDIAGeB^na zvxMiYZb8g9C)P{0BsE}nLKXH#=EFbhA-eh`697iT{M>Y8WP}xc&c9uZ6UjFaQ_)2L zp24r64US2b*c(-VU4n<8bMq4Fn7^N*5GGuM-Cwc{FMW74*LLlhYRT%*N~{RHj}-ys z_#~tZPVtrK=n;=6pAtYBZlyVGH1wwvGm%vJ3^5P75kdfbZ?xfXc0E47(typ$4cJ5g zHVPW>kBha;Uyo*6k=IxNwRyZ_feR1az(S8Z&?Z{MFTx6+0_+aIiwBM=jb?s{ zuof{TjW~C&3&(D^!{ho>*b0Q;#R;(?<}pmdAHpb1h^78_O|v8UI)@7s+S@`gpLZ12 zLAhw}?w^!|DOm-mZSEM~`{xl+psB43o)=1B6Iq4zA>}Y|O~E`1AH28wEVSM7!KwJ;!7K7P>!xl#4#82IWn^p@SkThhGomcTRJ0NX z#bsmj>3i4}`w;xgkI*U_V7~&@!-yVE6*bLRW#gXD;mn+txw5_NddS_J+-iEID#x*m zY=?hD8vgd>b(n>eVtsHi0yBgV4@xH;$x`Vc?w6MpT3cDZ>*wn;J@@|peokv^s~$0K zSG|zXeDDa4hW^fPu!f%wBaalkZ+8ZXdFAY?RWBq|Hv+6jdTlso1C1y!OhLh%);EOIjj q)ZbY4OPW6~RvgZ|L~s8T^Zx*V^%fCz92x!q0000LyaMHPWTneHRAZix<35M(*Uh5HXPGcy}{`}XZW$9zXehfG^r+lQ^K ztv1cg&HhADEiEkx&!0bkK-z-Fre@)@N}-71bp^)Zc`%PI?iGWGf;z&!595e@5tGZm zQd3)Zp}xM}qqMYiPi}7Rvbeao2}~waff}dLqen|0puN3ahM1m3AS#Jz3={!FWo0FF z4NYO>6ASC>PhoxS364>^`UECE*P+j_h0*y)#OKxEIr)5R_jg5P02-T`n(_$H<*KTx z;{t&|H9I?do|l)`2&pYMVo;``px@(pn<58F(E4GJ4o=Y6%lZPuN`G;&ey zsAnk5UH#yGDFW3sLdqchd9el=h)x3o12*aQQ>g+pHZ~3lKy^x)s;a7nk&Pp40TC$Wnrfi%W`}oZJf1?J%hUv=M;X+S*qFR99ES z?6e1*VjjXHu^1jn0@4cLl~@FRi4YwfFU$`H(bm?AsHmu-2@@u4BVE2DHS>Re?|nM9 z3A@Q#-PqjHFwlH2KurxSUH!pIC`Mp4ZTcC3pC zzE^_FIdzCHs7GCM8#+5XXaKPWf{?=jOnWD>m{2n=jho|A6zQ?(e*@#pb^=_E6Fe z%I59o7Ql{s2Q_sKG(cbTy#PWXPI(3);z22H7dD`xp_Q2Lq}3N-AcQYF9I7S`*n2J< zdwmnIJG@Y&>6gJ-vgVK&h*%3;6|w*muks z=Arj+Jnk7xxmnobbsgJI_(H=q20KCvMQRr^IE!>_CpEtggxLJD!yZcN0es$eb{@9a z2SM%VIq14Y;^dWwWDiINpk^Q_{4yGvT4;lVNo-zNTZ^Mk?l2FC#hK)CoVZ;M^Q(n8 z5J+akDFiAEXKZndz<)vtL|c3^IG^kM%AOe3WBw~*Ue%A!(+m|rC+GpxEYCpwxHt5@ zZo=V4ZucgZ0MOF%9F^oY?&>iqNz`{d1K2P<9|n&*WjLE!3HyX{FmIH=AoKxtxJ6?l z(-msg?${Ze1C5Yk(a+u)9A#|@%Sl$D`>6cVh^4gIm(Tkpq!=2Z#n{d%#{Q6W=(E+W$3?Lre&OQJlk*HVVe_xA@gNc(jeD6GkPkIepQ>$Q~SOLq}QW$b` zu*2g9cDQn(ACiS_#D_ZZqZV8w+US+eQQB!UsiiN(-(=Cd!S7MKwpS~<|$E6W)>feQ|I89l!xG~S{mSN4*)Z^ z3gb)M;*`8%v9^#V{+GJ570|6J~r61l>SkA)5y zm~Weg*;Xl-VUdhEmOLyuk%o;fX=Ht7qN=``2I#wdehq+n#BE5#Wt7}d<%tntaiGBUu*r_wP^&xb>Nf83iX5`8ja z`ZB9=I)OD)%#ty+55P=|B+NGo$716!?DEO@O*7Dc8Hw;%@C;7mNOq2Y3j15nz$6LJ zp~zxlyZ~FhGVr}kB$nFV#6n_r0lgYhp=i#d2X>5xn?Qc-Tz%sCAN|TXL<`=T_Jzy1 zU4g=>1cC-IO~51_KTOkbfbyYW?DV{gs=8*0dw^tAxc?yYm7BO*ow%NoiNn6hI2`&I zdVx9k#VZSI&t~8&>p0Bb?TfLS?J!ZFjcKNdm`c1*gZeLxb5G^ROlK0Wii3sPR6hC{ z1u>pLOk?mc^H3DVtTw>-O-C_ruOBqeC84sesUJYUdw|43r`&z#`zu=o5x_fHVYsAV2rVAO)%5=CK=3RjNL|?wwtzB zK_Dg&h*@O$%-ijS@f*xBedjrBb-am+TFC&^P0Vz@04^_&jzA?{WZg5=iDwnnIK;Y+ zt?u`+(d{9=u}_B5p-@azKaFwg8CY;I2s6x+UfcYj5VM&)C>^{=FQbh%TvP}fUU?In zIr+l*N;Xm-SH3co5XVBihxyoiG6t(0)3C(yI%ev6V~V;xl#Ig2{^JcaFZ;S7Q7^w=h9Ww~!HT9B%IkJR|PWiwlA{(wZ3sF#B2T@m-#9)rf&?tDX=u|8*~Hb3qSM_w|7E;SR$P(Kro3L4<$aJqv|XoT2r=LM7COjwZu7wc95eRFpW z5>mg|{OzbE5$+xbHZkvt&&{HH%@6+_=KDd6?Ah2qxum0<>;VcuQbwk0?TI~p8T9FL zh{Q2rcb<^{lbj2PXYWyg0Bg+yG2Ju{<2Bu+V!j{5@F|O3zO@JwmI);TR8`kN%aTRH zj=Rte$RT=!y#ZOcliwZSwZ9@Sre-iAiH}cJtxM%TR+O6geh{lSX|gJ+h3$RIAYzF2 z_BI+oo#BoRXHuc&nFVzsRdPHU24&(|bt5|ajQ(JiiDpvpI_J*1D~EE5UaY#>+7=dzWke0y zyYId$J@-`5M=H_tiRo%dbs;JjSgm7$d3xvZx#2~8!;Hi-MmUrY24LX2~O!R$6SMOM+GST6HhR{&WONdTv;8JORtCV=+g|5o6bxVX>Aq zGV_Y)^)9Kj*i#z?pU;n9xpJlApHkd?u?MQL=tm7q_|X8$jH{SMjzj7qR6fGR*wynMtu{)j`Xqpn~LzJJNUl$n}nXqBQhOc^pP3Zwp<#qA&ld?D+z?GJji};U= zaV0JVOH>bFt|150&6A z`_iRLx5>-P&mrB8l-d#^zYWL`vs25<%WsiiX3`@fB5s^Nf8O8Fz`*_Mm8+v?tD4u& z(7S*+hFmE2gyM=lqTXjP2!ur(4fOB*K4tvuoKmvZ>#knC`oPM{%5(Yh<=Yh$6y}qz zMoYD*D}K0Kt_9LLh->gm5wUiNO+)Vxl4QJ z`mI~Hs*D^tQi**3{XfL?8$83sVaNEMe1eMK`|0J7SXOH5Tbh@hI4PnsJ1T<`t0x(e z`VITXKujeNI)TE;W;{@N_9t(N`GFA5W7M1lA8oSBl^-+1;%zbC7h>*E`4QWO$SSCk p_i1mF`QCyb(RV}lP)dOR?q!A`4ka5U{@uOL^FFsR*Yo~P|ISfD;(y2gjz8s)p0i}I zoT>N6t94!98$5K_p#LWClJ84R9k#eXE6{IUKa>&4}0s4Dbr@WtKocc zzhPLhKtH?;29(ykhk;~L3lNf=H_OJ$B!Qm5eNjIKYaM`UlkPJm?SvISW78 zTV-X7>HEv#;^Mxru&@~U!3Q6_@k#)A`t&IS;q#W3mLfVglAe&-N$9S&))r*tgNCL@mCUyvJ$iJHU?)~qR=V3mBE7t4?Fom3?Gkl$b^QjAmY$AZ*C}A9kp;|rV{rKD9nxJ^R$S@@+(WV3!~$9d zrr2e40Ernn?C(UTd-}HMJ*A_Ss!EZruC5FvZ}2MxptZFX=^2?=tD*{>Lq}ocbP85y zlVKlw4|dUfSomIsfrC5rY>tCt<%rOztKDPb1yHi(h(y@ z?4YE*|H@PWQKA_D8Cf|{*<*r3{#RjtJ`E1x>2Nro%F3RuZ9-Gv5tV`R>N>QNdHQar zdV|1#ijR-4nlNF)A!d$6`pbYcf&e6{s;Z{<1fXkz8336%*Ra*V8uk}+;2K*BxA-#B zEmp_lO5qV-f|BxD_HVnI?+pU;yriV$@scG=d?-n?2BheB1wdWVTuMl7Z|2!uA29wvi0?VqOFw`&u4$S-HX|?GDc7)gVNutHpH? zJZ_=EQY%{mx|afR5SYISiHO9K?Z!}Y;@(|u>LWW)a|g*0|CAc8;K=3d3@sDb#@|C- z4*lHzvJPC1=DAYAo(Mi{BJ)ryXzT!;vg{h_wScu%Wea#*?R~Yj)B+}kPWT#x3M*_kpIg|gut3#W6$MmJ6kH) z8P12+=|mj#y(AVuSMyB5+uJ(;7}&YvLS8vy$^JV4$9`b~>?^F2XebUH8uYj;~hH!uT6=ku}8HxcT` z!m!!K7h6wfK=m9S8~qFUKbgKb2(0;)c3jS;pi;rs5FR$W$6%9{C)AwJ!I}m%bq$aD z0ic}#0oWyBik=f;rdK*Te9jEwpUB;1th;Q)&fl z5+A}cwj73+c-S47g>5IeP&#r3EB0Gsxz1s%KbZy3L{4Zo)iOjDL z<`GdIc2H51)jtAx3wNj<3x~FE3LIie`vkxgVa7~jV-qN-(Qg2ZnBTjd^1*gfdmM`? zf=6a0Tv97x%K~@+qsw=(_gp^IPQ^jlE(j|O93f|93r)XtFzHqf;z9mQA^&^h{zG8R zFSUu{DEOBMl!7`wqD&uCrB-&Ye-bv@`9am~5_LbBI2zAKT~l+P02p=8S&^9f-BqIJ z%n@}Z8ryWu;c_VlJ~U$V%&LM*8UaWm0C5E1%6;rRUj((&$xuETiVf5j>1-(F!eDm*b4_ji*-6u=t*9F|d8sAd<>Qw}p6F2dl^L6~&E(ia% z&BjvaYfwI(iWPS8*b{IAHPj0{d4T|!qq4FJx~7&m=ox}@xesvmMjg%&0FSI{I1>OH z0$@P^46l}B&xKo54QPxJRfa8Lx7kc%jLQ=M#<(15UEnRqlBZRt3;F*x^j#$`+Wf{O z1;hD29Lv2w-!Ts}tupb2St=$PC1bpPBF5__vgawrNtkVs3K{!MC?3zmZohm~3w|E} zam8PBh^}wnxeH@!XZR-EL_}d7f(d{R0dS`h;6wnd34l2P(5EV(PccQan7h!3xPuKL zLi3%*d5{%qEt9DMJS=s~Ng4gs;&J48&~Gz435lU2zg3hSt8=AptZov<>Ly?unU*3+ z>vx!+zyL5w!W_#qEV4?5jAayd`CfnF0N8s{c77pFL?qFKsS-i?b@0Ac1Gmg79HmC^ zFg1c^)ClTbDaXDGrO*t_fod2Z>#6w569Bm&p?NaA%C8K|yi4%C+fB^1%f;vWFBS~_ zblRNmv4giH2mf{9J3n!_V|1e1$LS@p=DP#k=Wsr*KYvg`u?8U z07lGjF2tw9@nROdvnt@8QPrgj6gGgD?m;886zkm+Am^HZ)u)TF)UyzaU2kB%V=iV} zXJe{GIwl&YKuSLupYFWyc*I;q5AyqEcK}QjRcg?iLp4V&*3M)gNa-g%3&0==lk{UT zS^XqtXr01*(vjC%n2m*&ahS0;7}6V^@xiY~_;j-ewOI*l zx*18a<}Wmln7Jy7{B0D*4Tp%2@<>PwBTW}U7{`fjm!=O)G$4v9P8hjpJ3d}*f-h8$ zV>TxQTTi5+y8cn0;{e78vod60<%Eiwdb)4#*FcD=E>G#qP07V}$4F?M$;Y@e?)1|1!OTsoK66qilzFmvS&_ks2maNf=KhR+=@RP6E9E?=m)B%rFksn4M>W0(nu>@amiWO^~4w6yliyhxAf zyDq`eP$(v!O0hi1tW9;uVFCM~= zJF}z+!X%><%%y)!TFwlgt+S*$=K&@AE2ye#>@g7134jb`QAkX~jDn(3H;~J#?6-Ng z3eovNRSkAKg<*|DBGypuFLlVmeDfH5wI_%z{_j)qpS=DEW*c9{1jCg7*nF=LKBsZP zH-?dztYQP{4GxgCia;d`pzqlr6BONQ>;#8Pg*Zi#;d|8$ESUbr1elmY=8ZC}H4ny8 z+f>T^WH$G|&^U!pWmd80jR8Pcm_aE z@qo;n>rl}@3ajt}*wI`*Ao&)W9zW?ZE+8%{!~{;yTuQ|P-5|^}zJ%$!{2{I4i0RY= z%r=ds9v~UxUXXdQ5Jq=}U`nxpgJ;=BjRDYCNGyW@DC~EDaY#N6M)F`0UWDkp`~5cG z(V(`Vfo7E)3dT&??uJRKu9!((@*J}`*1XgUHs3RZ{Y;xcGefrw>IM1{6eR%Z+1DwM zX@`CO*I^h|3d7J6903a4l1V!5^rG`(}Mhx&7-Pv0F-0NaZN?1V~OXuPMj0j4TkO}U17yS*@8 zH@3t4*Due!SO}wj*qQaSZE|}>-J^aijI<#wD;F|5tg*>Gi>9vy?0|;RHm~dOOS(k{ z`@b+E`nGLAEI!+KoN|68_hp-Z4uZs>A$u2ZG0v%|ZFnkb1A1N>YeOml_)hIGCS*3{HA zcVDu8esQ!7DVbDcw^(AiT@uzDyN0#Ym#=lrWzQ>}v$4ZF3-_uT*y7!v#ZeIi+C)_= zCnvXu(lcs6*9V!ogSEBwD%z(b=xceLF_oO2jhPDiSY#4`C04PJIUEm}BOO|DI1b+( zxQs)=8F=)#xnJf*{|@s!H#aw99vuU+HAc+xcujvcNF=3YV)F7Gn7P9fb9Dmn4JQcS z8HZtk!8y7Q#O%HPn7hjhA@O-Eu>Nk45bEj0ix+){4jnqSYoOy#-5}9@i%ddF2F87- zjPVMV_*}&fb9Q=QxlKHNK6Dw=x4U5C23treT48~P9d4A~?S#jn%=Lo@51!CIq1#jf!WJx8AS3Jz1|EQ@W$xOFH_?i2O>G@* zXt;#W=B>i4J^q+XL+J?yiO=Xuf-pEyVj02ODoa0XA0wb18cg6gNd)bBOHkQU3kw#Tt_gu(=nCSrg%aO z8(tH|>UtD~vAP5^HjW=Z{_Ckzr_NzVpAr%uG9ml{+Y9(2=MJLqnkd@LN_#-%4UURn}C2|707E^6@9uX6JyBoJx6;Ws7_yFvpE%v=UA#1Rs#<+8`4)eLG)8}j-He&#P2vs@qUSBZFVx$ z1BX_dAgslxZ}5f>_z=xgFvAeGv{FiT$&bteHgUEz{ECXS+Ug<^6jQr3-SpliaV9qS z;NkYB_rD=`k{wKkqrMb0dR+Ssi5V3yNj2FOt*EUNLtK+9^daSe+75qksI@dcM3%$Xgsq!>(ptN6L!q@so*MR#*mp1__-~M+>3yu1NaWA_gY_0@FK|a>%>iL= zfa1UD4CtR&2ouxyj2Cl$ zSLzmLxO$o)ray_!Jg$Ag+~?stNRNsXb3QXLfMnd^bq%+(kbs zJNfn0urt=M6HA)0JATG-w5u?B5og%hfTFjH7qjT1$3C%(D;4?*+)DA1S2na>!ynnN z#~DE|0F;~oCo`nEVhuPJOZf5?^8i72VD39-K=memP$C1M*$bGfBo4Sc2iU6l2SbNR zgHGrEQB%%~bKmZHV3k`)KccmV%WW{o&H1q=ZEe~SU^ z;(&%t`~xjbz_d=LD+YN*eLeHq^#JO+cgaG4p3lZFoV4B9{xRc@gQs# z*1dY1E;K1CHm6FQGeF1{sDkbASA`8zDEl7=HbU_zDJyp4Uq>ufj=jJZ{OiD$XT_H9 zYWwGiOk|Lk+QfJLk;xFGn9*db{~LS#yB-H(>ID?kjyDRe5%>9-|0|oJ?Ukc5fckY; zrd%V=`}cjz(-s+0nb5(?5h41 ze3RzH^E80r;t!Gj z{hLT6mt;rAl-SZrNyc)1mB=Zcb0U(nI!7i?>j_M$64UTqsLT!$ZmT4P@YF_CokIUnIZ}uppI0-2|4{=fsH**K*d*c~_4_5N ziXQ74!IWYtI_x=i)yz2NFBR|$W>5gP#g{^0DG_Y!2IQ&{cH>_P8{1(5Ga-)}$5IZ3 ztM=G(PTHuK>`dC&a`xDA^jokQZ6T zI1*dVA@?68HioIjuKJE#{YzoXRVy)RlVV+13R})g8#RtC_m{%Pp8UMpE{}SFmD6s+ zwh-_L?A6~136H>bquu&D5wJ6nW0#E}{!Lh+P63<%$V85vEDBfi-bpcITmPMMq?obI zEOP%%u}~SPHmdgQHMR4}YwCav64{TNMCgXgu=&% zq;!6}d*c=B#bwX*CP!KK1-FlO7@!zWJ>PzlY|$s@^x91+fe}9p&+p5$*1}HBR{b9e zz$z=ewG%;&ECJ?i6}-Y1Y!Wt*64c%hD8z?yk$mbK%k}%RlUuqgia&oKNojxb`s?F> z93WS#qiDBnH4_lYyU1Z9%LVL5=&fd@u0vN+M5Hh`;Al;9Pd8a#!6t3z3{A3PM9X&& zp)L@$Api<0!z0Xvh6UvMfE| zBUMz~COv->WV_y0#c)W9Gu$7%DZa#jYnBWYaBdUFYkEo6(RY`=@$KZtN$Rc%KwiD z-BKQ;zC*MA=^ej%_wX!tC*pJWbz<@L8LGqez6Z{IHC#*mDLiw@jxXENc))dBQ=fta zz~!zl%QbP#%OT63AX&IA|64!^GcJd0|JPXbUsKA$e+|C>efj?a?j4pw>MOC~@L@w7 zJUGlrugc3VJ57HYtbEt3to0p+3lByMZ%-1TymV;QI|Jse1+xSwL45{3RT0t|Q%k!K zjbP+AR%z=1m&?!J#mHSZxgoG#nY*Q$%)F8}Qvx9R6i)4algsuQwGP+B0q|L;d1x?= z2EnovoeY1+X8W;>4?QgO6)oyGBD~d~Qf4q|((VR{^d6?Rl;D#)yFRStbfK3+Z9i*W zQeCZzyRrYc^}+KKG3g>`OYZnK!@$LR>pNz)c`oti<`i;zkhk$VzgFZxEd8Pt=J@tI z%~hSDGHP?+({e_Yz*OWFthp_H;fhCu%T4%tB`^ya*T&kPc3RbQSeFjvM1cOllc;tF ztNs|GS3AjV!dh9h+~2aSgM7a|*U|sxmlC|@c>1!g3y{uvCRUST6a5ldpsP$pRY?afd9l|aG%+i(F4Qv6 zeVE0PlBdZd@{GbQl_)FtMsVKNobM=e9){3PLhcftt_`!~xC_J-%gwGKo03!9d?zfJ zG_LIuWG+H`rM{g&sD{QgHOw!j5+@}DAGnb;?zK{va31)fXR4n=x%1WXF%rh{_~xG( zbBMK8JOax*oI^0~zAEDmV9l?#@{3Nu}FN_k;L+&b;du z9%jX#bmc!PSM23`xdQCGmmL+z9Q%Az7^A`96_+^TdC%V_L+6n*`jktQe(G@EIV(6- z-w%`YC=$jXWoqEpZ+^k_2yT0k2(I&yL(R83xMGhR2jw;Il*>k;>j>WG*Av~9_|{hn z99S}3qa;gXMb{u)Oh&7oVaSr)l0c(I}g9)nCjyiZ;7O9>8k&TN1t{ zny~8|CF^kiils<^?~U|bNz|_ON@D`+IpT9A+4Fli$PpJ;mwE3w;z!KecTPSiueG+H z-KZnxy5p%encMAx-Tq81(-u@dgl`Lwi1&WG0!KBXg?hA}U;0a?-cGv3Fj^BpD12k4 zGgRFVaDU!m9#3puRW!e5)iPxayxelhptZPZi^rdtS0`H6M51|j-EKKJwyaa7!S{93 zT81Y}10T_H+H$!s{BZjc@dT8C?}ZdzF3(_zx@~R9e`AaGc$>$Rl=m558E&V`>#`I6 z@nW%B5hXMbZ?q`wNueODV;?Xrqw1>?O9x zB*rS~^dBvF+51yIVSoE`qGQqbW7ls}D*Q<{M4@{O!+wJ`2dkDPZwEJ^S1aO^UrlIQ zzdiqXO2<1i#CurIno)GKB3hLznQyciv1UAx*vW_d1F4F25wMGMnyl~79&~tww6XlL zH2BzXzc@A^Crk4ycaQG{lk?N|Uy`;_7pGa8hbKpNQ2YHi_m|fu?=jW=TyvM8@#x`p zMUxm>58P4riX`1ASe3@KuaJs#u$8&5KzCiT9*{yZZM%9CH@C)Q`em3)D}r^?X2WdC zg?30RLx{7+W8=hm`XqV!iYq?4za~-Y-A?%y(tl8pto(fp^kGNS|CK2hTe=H|oD*qx zy;6lg!QF^g@vsKsp_3u`rIc`TeArryyaaxHX#!_v1M5GUWCLDdMr>H5+w4x$#lJejLFSDbcb@z z*6oeRy1UUhqrOB44f$#K@pBB7p2VzvHVrJCF0XWouJ*Ih`Ic%2cU|k51a(DrAoqgN z?+rS%@WqUq6oHZRXw)A`5+iVcOm&IES7@0lNj5#YE$VF~vF$;+ckw&l%+}c8m_bm0 zTzq*Pl=;uU__8*!#}guno(q*-OYXQss-~osQpir@xGOP7!NM=_NH6EwlsR0B>0-P;{a_2tu*h_12KP%M zS3tu3_7PVbOczP&AqQ7F)febrI=G~_7yNs~`! zP5O2Zk}89r=Gl0sv%k7&WR;P{^w3^p;X={a``oho>tAn-nmgdXSjBY#2%Z-=(i@ zr*_Y|`~qUf77nT30mhqmF7!d$2?~z4=dt#gzYp)VP$5CXz_9k2`OD!8BEwn6Mq8Xm zwzlpTM3Y3Bv!d6q(fZZYg?>ND+wmOcuv0m8Mi|eI8-*M!#;@^M@^On9=Yv|oL04wL zN2@!_Mu73oq!DhQk9k-TOJHT{@iuo?%53)>jqoQQ1G6LOV_Cm*kd3Diy!tbgl+IeK zIjqUALEW&cUr+DJ`pw3Vx%w`1B(#c8mJJf~XQ+MXLKOz3^`Eoox2BcGP8Q3uArcUQw{>$u9({?GY6jvD%&d>^#e z)hN2$2{=!FRMLon)xfE}Xk}Ma4+Hz_Kz+;S20N2AqDigZ-;W#?|-8ghVdk8{0#_9>jX|ervyI5-h`hP`*C#K(EBLu*tgceBB6SP{5!tBa`Dg~W}|Cc z=&&fh`Yr7E_hu&x%Ffy3fgNzH3W`A35J@cbNS=Xw&osF$LRxa(XSO&6XX zwel75;F;Xig6L0zLJLYk&D7heEo9YY2d%erZ(TNu%!8qm52-bZBFA06dk3LGliVpO z)Ookn^{w-7Yq!){^C{fb#7SyG5>=iDxy8Hd5%0nAbdV{daW(4XGn==mre?cecetz6 z(R#LXpM{MiEx+15@6smD{_>>r-n}7XdraN8_OtM#X)2ka-HhHsh9+Es-lXCqnjW@J zV}g*Ja7!P>J`cfN!D#(hrj7*ZXaq;?p{SU;=MHa#Ebky>K$UX(jT+yaxf#T~RTN&L z>?RX~G0MmENM!V!t`+obU#^p;n2749D3;?^QO|b!{8*hfMD`UQpnlNpjfs`>kMmNrvFt(@KDR~;F60KX{(Lv z0TVMyO+A>pi22D+#h0-hQd>oE>#VlQjjmgsI}cjsNP{TsEgR3I7cBLNoe0b){ZbjL z$ZfAqw4KPFc2Ln#q08Lzo@G^y6DTRRdCP7mltEdM9jQtzDgMa+wdy6^!|PbeKH?YL zo7Y)VNl$(WKdiT5E94rsjg1R+su0&<&e`&Vq^j``>k)~f3L$Yhf^0wyK)TJ+P6}HI zC4*sJ_wc&f1`oatc@IQ}OMvMRe diff --git a/plasma/applets/homerun/icons/lighter-logo.svg b/plasma/applets/homerun/icons/lighter-logo.svg deleted file mode 100644 index aad95c11..00000000 --- a/plasma/applets/homerun/icons/lighter-logo.svg +++ /dev/null @@ -1,2919 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - base - - - - - - - - base - - - - - - - - - - - - - base - - - - - - - - - - - - - diff --git a/plasma/applets/homerun/internal/aboutdata.cpp b/plasma/applets/homerun/internal/aboutdata.cpp deleted file mode 100644 index deb5d78a..00000000 --- a/plasma/applets/homerun/internal/aboutdata.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -// Self -#include - -// Local -#include - -// KDE -#include - -// Qt - -namespace HomerunInternal -{ - -KAboutData *createAboutData() -{ - KAboutData *aboutData = new KAboutData( - "homerun", - // catalogName: we use the same catalog as the one loaded when homerun is used as a containment - "plasma_applet_org.kde.homerun", - // programName - ki18nc("Program name", "Homerun"), - HOMERUN_VERSION); - aboutData->setLicense(KAboutData::License_GPL); - aboutData->setCopyrightStatement(ki18n("(C) 2012-2014 Blue Systems")); - aboutData->setProgramIconName("homerun"); - - aboutData->addAuthor(ki18n("Shaun Reich"), ki18n("Developer"), "shaun.reich@blue-systems.com"); - aboutData->addAuthor(ki18n("Aurélien Gâteau"), ki18n("Developer"), "agateau@kde.org"); - aboutData->addAuthor(ki18n("Eike Hein"), ki18n("Developer"), "hein@kde.org"); - - return aboutData; -} - -} diff --git a/plasma/applets/homerun/internal/aboutdata.h b/plasma/applets/homerun/internal/aboutdata.h deleted file mode 100644 index cab266c3..00000000 --- a/plasma/applets/homerun/internal/aboutdata.h +++ /dev/null @@ -1,41 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -#ifndef ABOUTDATA_H -#define ABOUTDATA_H - -// Local - -// Qt - -// KDE - -class KAboutData; - -namespace HomerunInternal -{ - -/** - * Create a KAboutData for Homerun - */ -KAboutData *createAboutData(); - -} // namespace - -#endif /* ABOUTDATA_H */ diff --git a/plasma/applets/homerun/internal/i18nconfig.cpp b/plasma/applets/homerun/internal/i18nconfig.cpp deleted file mode 100644 index ac052b4f..00000000 --- a/plasma/applets/homerun/internal/i18nconfig.cpp +++ /dev/null @@ -1,34 +0,0 @@ -/* -Copyright 2013 Aurélien Gâteau - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 2 of -the License or (at your option) version 3 or any later version -accepted by the membership of KDE e.V. (or its successor approved -by the membership of KDE e.V.), which shall act as a proxy -defined in Section 14 of version 3 of the license. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -//KDE -#include - -/* - * This list is never compiled in Homerun. It only exists to mark Homerun tab - * titles translatable. The I18nConfigTest in tests/auto ensures this list is - * kept in sync with the config file. - */ -QStringList sTabNames = QStringList() - << I18N_NOOP2("Tab title", "Home") - << I18N_NOOP2("Tab title", "Files") - << I18N_NOOP2("Tab title", "Applications") - << I18N_NOOP2("Tab title", "Power") - ; diff --git a/plasma/applets/homerun/kicker/CMakeLists.txt b/plasma/applets/homerun/kicker/CMakeLists.txt deleted file mode 100644 index c0dd2e6c..00000000 --- a/plasma/applets/homerun/kicker/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -add_subdirectory(components) -add_subdirectory(package) diff --git a/plasma/applets/homerun/kicker/components/CMakeLists.txt b/plasma/applets/homerun/kicker/components/CMakeLists.txt deleted file mode 100644 index e96975dd..00000000 --- a/plasma/applets/homerun/kicker/components/CMakeLists.txt +++ /dev/null @@ -1,23 +0,0 @@ -project(kicker) - -set(kicker_SRCS - appletproxy.cpp - fadeouteffect.cpp - fadeoutitem.cpp - kickerplugin.cpp - processrunner.cpp - sourcelistmodel.cpp - urlconverter.cpp - windowsystem.cpp -) - -add_library(kickerplugin SHARED ${kicker_SRCS}) - -target_link_libraries(kickerplugin - ${QT_QTCORE_LIBRARY} - ${QT_QTDECLARATIVE_LIBRARY} - ${KDE4_PLASMA_LIBS} -) - -install(TARGETS kickerplugin DESTINATION ${IMPORTS_INSTALL_DIR}/org/kde/homerun/kicker) -install(FILES qmldir DESTINATION ${IMPORTS_INSTALL_DIR}/org/kde/homerun/kicker) diff --git a/plasma/applets/homerun/kicker/components/appletproxy.cpp b/plasma/applets/homerun/kicker/components/appletproxy.cpp deleted file mode 100644 index c0a3a1e8..00000000 --- a/plasma/applets/homerun/kicker/components/appletproxy.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2013 Eike Hein - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "appletproxy.h" - -#include -#include -#include - -AppletProxy::AppletProxy(QObject* parent) : QObject(parent), - m_applet(0) -{ - KGlobal::locale()->insertCatalog("plasma_applet_org.kde.homerun"); -} - -AppletProxy::~AppletProxy() -{ -} - -QObject* AppletProxy::item() const -{ - return m_applet; -} - -void AppletProxy::setItem(QObject *item) -{ - if (!item || !item->parent() || !item->parent()->parent()) { - return; - } - - m_applet = static_cast(item->parent()->parent()); -} - -QObject *AppletProxy::containment() const -{ - if (m_applet) { - return m_applet->containment(); - } - - return 0; -} - -#include "moc_appletproxy.cpp" diff --git a/plasma/applets/homerun/kicker/components/appletproxy.h b/plasma/applets/homerun/kicker/components/appletproxy.h deleted file mode 100644 index f86b162f..00000000 --- a/plasma/applets/homerun/kicker/components/appletproxy.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2013 Eike Hein - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef APPLETPROXY_H -#define APPLETPROXY_H - -#include - -namespace Plasma { - class PopupApplet; -} - -class AppletProxy : public QObject -{ - Q_OBJECT - - Q_PROPERTY(QObject* item READ item WRITE setItem) - Q_PROPERTY(QObject* containment READ containment) - - public: - AppletProxy(QObject *parent = 0); - ~AppletProxy(); - - QObject *item() const; - void setItem(QObject* item); - - QObject *containment() const; - - private: - Plasma::PopupApplet *m_applet; -}; - -#endif diff --git a/plasma/applets/homerun/kicker/components/fadeouteffect.cpp b/plasma/applets/homerun/kicker/components/fadeouteffect.cpp deleted file mode 100644 index 1eab4749..00000000 --- a/plasma/applets/homerun/kicker/components/fadeouteffect.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright 2013 Eike Hein - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "fadeouteffect.h" - -#include -#include - -FadeOutEffect::FadeOutEffect(QObject *parent) : QGraphicsEffect(parent) -, m_covered(0) -{ -} - -FadeOutEffect::~FadeOutEffect() -{ -} - -int FadeOutEffect::covered() const -{ - return m_covered; -} - -void FadeOutEffect::setCovered(int covered) -{ - m_covered = covered; - - update(); -} - -void FadeOutEffect::draw(QPainter* painter) -{ - QPixmap sourceItem = sourcePixmap(Qt::LogicalCoordinates); - - QPixmap pixmap(sourceItem.size()); - pixmap.fill(Qt::transparent); - - QLinearGradient gradient(0, qMax(0, pixmap.size().height() - m_covered - 8), - 0, pixmap.size().height() - m_covered); - gradient.setColorAt(0, "black"); - gradient.setColorAt(1, Qt::transparent); - - QPainter itemPainter(&pixmap); - itemPainter.drawPixmap(0, 0, sourceItem); - itemPainter.setBrush(QBrush(gradient)); - itemPainter.setCompositionMode(QPainter::CompositionMode_DestinationIn); - itemPainter.drawRect(QRect(0, 0, pixmap.size().width(), pixmap.size().height())); - - painter->drawPixmap(0, 0, pixmap); -} - - -#include "moc_fadeouteffect.cpp" diff --git a/plasma/applets/homerun/kicker/components/fadeouteffect.h b/plasma/applets/homerun/kicker/components/fadeouteffect.h deleted file mode 100644 index cffee392..00000000 --- a/plasma/applets/homerun/kicker/components/fadeouteffect.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2013 Eike Hein - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef FADEOUTEFFECT_H -#define FADEOUTEFFECT_H - -#include - -class FadeOutEffect : public QGraphicsEffect -{ - Q_OBJECT - - public: - FadeOutEffect(QObject *parent = 0); - ~FadeOutEffect(); - - int covered() const; - void setCovered(int covered); - - protected: - void draw(QPainter *painter); - - private: - int m_covered; -}; - -#endif diff --git a/plasma/applets/homerun/kicker/components/fadeoutitem.cpp b/plasma/applets/homerun/kicker/components/fadeoutitem.cpp deleted file mode 100644 index 65290e05..00000000 --- a/plasma/applets/homerun/kicker/components/fadeoutitem.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2013 Eike Hein - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "fadeoutitem.h" -#include "fadeouteffect.h" - -#include - -#include - -FadeOutItem::FadeOutItem(QDeclarativeItem *parent) : QDeclarativeItem(parent) -{ - setFlag(QDeclarativeItem::ItemHasNoContents, false); -} - -FadeOutItem::~FadeOutItem() -{ -} - -int FadeOutItem::covered() const -{ - if (graphicsEffect()) { - return static_cast(graphicsEffect())->covered(); - } - - return 0; -} - -void FadeOutItem::setCovered(int covered) -{ - if (graphicsEffect() && covered == 0) { - setGraphicsEffect(0); - } - - if (covered > 0) { - if (!graphicsEffect()) { - setGraphicsEffect(new FadeOutEffect()); - } - - static_cast(graphicsEffect())->setCovered(covered); - } -} - -#include "moc_fadeoutitem.cpp" diff --git a/plasma/applets/homerun/kicker/components/fadeoutitem.h b/plasma/applets/homerun/kicker/components/fadeoutitem.h deleted file mode 100644 index a4fe9345..00000000 --- a/plasma/applets/homerun/kicker/components/fadeoutitem.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2013 Eike Hein - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef FADEOUTITEM_H -#define FADEOUTITEM_H - -#include - -class FadeOutEffect; - -class FadeOutItem : public QDeclarativeItem -{ - Q_OBJECT - - Q_PROPERTY(int covered READ covered WRITE setCovered) - - public: - FadeOutItem(QDeclarativeItem *parent = 0); - ~FadeOutItem(); - - int covered() const; - void setCovered(int covered); - - private: - FadeOutEffect *m_fadeOutEffect; -}; - -#endif diff --git a/plasma/applets/homerun/kicker/components/kickerplugin.cpp b/plasma/applets/homerun/kicker/components/kickerplugin.cpp deleted file mode 100644 index d08e127d..00000000 --- a/plasma/applets/homerun/kicker/components/kickerplugin.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2013 Eike Hein - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -// Self -#include - -// Local -#include -#include -#include -#include -#include -#include - -// Qt -#include - -void KickerPlugin::registerTypes(const char *uri) -{ - qmlRegisterType(uri, 0, 1, "AppletProxy"); - qmlRegisterType(uri, 0, 1, "FadeOutItem"); - qmlRegisterType(uri, 0, 1, "ProcessRunner"); - qmlRegisterType(uri, 0, 1, "SourceListModel"); - qmlRegisterType(uri, 0, 1, "UrlConverter"); - qmlRegisterType(uri, 0, 1, "WindowSystem"); -} - -#include "moc_kickerplugin.cpp" diff --git a/plasma/applets/homerun/kicker/components/kickerplugin.h b/plasma/applets/homerun/kicker/components/kickerplugin.h deleted file mode 100644 index ff328e9d..00000000 --- a/plasma/applets/homerun/kicker/components/kickerplugin.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2013 Eike Hein - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef KICKERPLUGIN_H -#define KICKERPLUGIN_H - -#include - -class KickerPlugin : public QDeclarativeExtensionPlugin -{ - Q_OBJECT - - public: - void registerTypes(const char *uri); -}; - -Q_EXPORT_PLUGIN2(kickerplugin, KickerPlugin) - -#endif diff --git a/plasma/applets/homerun/kicker/components/processrunner.cpp b/plasma/applets/homerun/kicker/components/processrunner.cpp deleted file mode 100644 index fdd75a81..00000000 --- a/plasma/applets/homerun/kicker/components/processrunner.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2013 Eike Hein - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "processrunner.h" - -#include - -ProcessRunner::ProcessRunner(QObject *parent) : QObject(parent) -{ -} - -ProcessRunner::~ProcessRunner() -{ -} - -void ProcessRunner::execute(const QString& name) -{ - QProcess::execute(name); -} - -#include "moc_processrunner.cpp" diff --git a/plasma/applets/homerun/kicker/components/processrunner.h b/plasma/applets/homerun/kicker/components/processrunner.h deleted file mode 100644 index d61f6296..00000000 --- a/plasma/applets/homerun/kicker/components/processrunner.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2013 Eike Hein - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef PROCESSRUNNER_H -#define PROCESSRUNNER_H - -#include - -class ProcessRunner : public QObject -{ - Q_OBJECT - - public: - ProcessRunner(QObject *parent = 0); - ~ProcessRunner(); - - Q_INVOKABLE void execute(const QString &name); -}; - -#endif diff --git a/plasma/applets/homerun/kicker/components/qmldir b/plasma/applets/homerun/kicker/components/qmldir deleted file mode 100644 index 45b1a6a1..00000000 --- a/plasma/applets/homerun/kicker/components/qmldir +++ /dev/null @@ -1 +0,0 @@ -plugin kickerplugin diff --git a/plasma/applets/homerun/kicker/components/sourcelistmodel.cpp b/plasma/applets/homerun/kicker/components/sourcelistmodel.cpp deleted file mode 100644 index 8b62abde..00000000 --- a/plasma/applets/homerun/kicker/components/sourcelistmodel.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright 2013 Eike Hein - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "sourcelistmodel.h" - -SourceListModel::SourceListModel(QObject* parent): QAbstractListModel(parent) -{ - QHash roles; - roles.insert(Qt::DisplayRole, "display"); - roles.insert(ModelRole, "model"); - roles.insert(CountRole, "count"); - - setRoleNames(roles); -} - -SourceListModel::~SourceListModel() -{ -} - -int SourceListModel::count() const -{ - return rowCount(); -} - -int SourceListModel::rowCount(const QModelIndex& parent) const -{ - return parent.isValid() ? 0 : m_sourceList.count(); -} - -QVariant SourceListModel::data(const QModelIndex& index, int role) const -{ - if (!index.isValid()) { - return QVariant(); - } - - if (index.row() > m_sourceList.count() - 1) { - return QVariant(); - } - - if (role == Qt::DisplayRole) { - return m_sourceList.at(index.row()).first; - } else if (role == ModelRole) { - return QVariant::fromValue(m_sourceList.at(index.row()).second); - } else if (role == CountRole) { - return m_sourceList.at(index.row()).second->property("count"); - } - - return QVariant(); -} - -void SourceListModel::appendSource(const QString& name, QObject* model) -{ - insertSource(m_sourceList.count(), name, model); -} - -void SourceListModel::insertSource(int index, const QString& name, QObject* model) -{ - connect(model, SIGNAL(destroyed()), this, SLOT(handleModelDestruction())); - - beginInsertRows(QModelIndex(), index, index); - - QPair source; - source.first = name; - source.second = model; - - m_sourceList.insert(index, source); - - endInsertRows(); - - emit countChanged(); -} - -QObject* SourceListModel::modelForRow(int row) const -{ - if (row >= 0 && row < m_sourceList.count()) { - return m_sourceList.at(row).second; - } - - return 0; -} - -void SourceListModel::handleModelDestruction() -{ - QObject* model = QObject::sender(); - - int index = -1; - - for (int i = 0; i < m_sourceList.count(); ++i) { - if (m_sourceList.at(i).second == model) { - index = i; - break; - } - } - - beginRemoveRows(QModelIndex(), index, index); - - m_sourceList.removeAt(index); - - endRemoveRows(); - - emit countChanged(); -} - -#include "moc_sourcelistmodel.cpp" diff --git a/plasma/applets/homerun/kicker/components/sourcelistmodel.h b/plasma/applets/homerun/kicker/components/sourcelistmodel.h deleted file mode 100644 index 4eec4193..00000000 --- a/plasma/applets/homerun/kicker/components/sourcelistmodel.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2013 Eike Hein - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef SOURCELISTMODEL_H -#define SOURCELISTMODEL_H - -#include - -class SourceListModel : public QAbstractListModel -{ - Q_OBJECT - - Q_PROPERTY(int count READ count NOTIFY countChanged) - - public: - enum Roles { - ModelRole = Qt::UserRole + 1, - CountRole - }; - - SourceListModel(QObject *parent = 0); - ~SourceListModel(); - - int count() const; - - QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const; - - int rowCount(const QModelIndex& parent = QModelIndex()) const; - - Q_INVOKABLE void appendSource(const QString& name, QObject* model); - Q_INVOKABLE void insertSource(int index, const QString& name, QObject* model); - Q_INVOKABLE QObject *modelForRow(int row) const; - - signals: - void countChanged(); - - private slots: - void handleModelDestruction(); - - private: - QList > m_sourceList; -}; - -#endif diff --git a/plasma/applets/homerun/kicker/components/urlconverter.cpp b/plasma/applets/homerun/kicker/components/urlconverter.cpp deleted file mode 100644 index a6a992d7..00000000 --- a/plasma/applets/homerun/kicker/components/urlconverter.cpp +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2013 Eike Hein - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "urlconverter.h" - -UrlConverter::UrlConverter(QObject* parent) : QObject(parent) -{ -} - -UrlConverter::~UrlConverter() -{ -} - -QString UrlConverter::convertToPath(const KUrl& url) -{ - return url.path(); -} - -#include "moc_urlconverter.cpp" diff --git a/plasma/applets/homerun/kicker/components/urlconverter.h b/plasma/applets/homerun/kicker/components/urlconverter.h deleted file mode 100644 index 7ad4545d..00000000 --- a/plasma/applets/homerun/kicker/components/urlconverter.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2013 Eike Hein - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef URLCONVERTER_H -#define URLCONVERTER_H - -#include - -#include - -class UrlConverter : public QObject -{ - Q_OBJECT - - public: - UrlConverter(QObject *parent = 0); - ~UrlConverter(); - - Q_INVOKABLE QString convertToPath(const KUrl &url); -}; - -#endif diff --git a/plasma/applets/homerun/kicker/components/windowsystem.cpp b/plasma/applets/homerun/kicker/components/windowsystem.cpp deleted file mode 100644 index 8d29c659..00000000 --- a/plasma/applets/homerun/kicker/components/windowsystem.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2013 Eike Hein - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "windowsystem.h" - -#include -#include - -#include - -#include - -WindowSystem::WindowSystem(QObject* parent) : QObject(parent) -{ -} - -WindowSystem::~WindowSystem() -{ -} - -QVariant WindowSystem::workArea() -{ - return KWindowSystem::workArea(); -} - -QPoint WindowSystem::mapToScreen(QDeclarativeItem *item, int x, int y) -{ - QPoint pos(x, y); - - if (!item) { - return pos; - } - - QGraphicsView *view = Plasma::viewFor(item); - - return view->mapToGlobal(view->mapFromScene(item->mapToScene(pos).toPoint())); -} - -void WindowSystem::raiseParentWindow(QDeclarativeItem *item) -{ - QGraphicsView *view = Plasma::viewFor(item); - - if (!view || !view->window()) { - return; - } - - KWindowSystem::forceActiveWindow(Plasma::viewFor(static_cast(parent()))->window()->winId()); - KWindowSystem::raiseWindow(view->window()->winId()); -} - -#include "moc_windowsystem.cpp" diff --git a/plasma/applets/homerun/kicker/components/windowsystem.h b/plasma/applets/homerun/kicker/components/windowsystem.h deleted file mode 100644 index b7d6a2da..00000000 --- a/plasma/applets/homerun/kicker/components/windowsystem.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2013 Eike Hein - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef WINDOWSYSTEM_H -#define WINDOWSYSTEM_H - -#include -#include - -class QDeclarativeItem; - -class WindowSystem : public QObject -{ - Q_OBJECT - - public: - WindowSystem(QObject *parent = 0); - ~WindowSystem(); - - Q_INVOKABLE QVariant workArea(); - - Q_INVOKABLE QPoint mapToScreen(QDeclarativeItem *item, int x, int y); - - Q_INVOKABLE void raiseParentWindow(QDeclarativeItem *item); -}; - -#endif diff --git a/plasma/applets/homerun/kicker/package/CMakeLists.txt b/plasma/applets/homerun/kicker/package/CMakeLists.txt deleted file mode 100644 index d82609ac..00000000 --- a/plasma/applets/homerun/kicker/package/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -set(homerun_kicker_plasmoid_dir ${DATA_INSTALL_DIR}/plasma/plasmoids/org.kde.homerun-kicker) -set(metadata_dot_desktop ${CMAKE_CURRENT_BINARY_DIR}/metadata.desktop) - -configure_file(metadata.desktop.cmake - ${metadata_dot_desktop} @ONLY) - -install(DIRECTORY contents - DESTINATION ${homerun_kicker_plasmoid_dir}) - -install(FILES ${metadata_dot_desktop} - DESTINATION ${homerun_kicker_plasmoid_dir}) - -install(FILES ${metadata_dot_desktop} - DESTINATION ${SERVICES_INSTALL_DIR} RENAME plasma-applet-homerun-kicker.desktop) diff --git a/plasma/applets/homerun/kicker/package/contents/config/main.xml b/plasma/applets/homerun/kicker/package/contents/config/main.xml deleted file mode 100644 index a9671279..00000000 --- a/plasma/applets/homerun/kicker/package/contents/config/main.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - homerun - - - true - - - false - - - - - - true - - - 0 - - - - diff --git a/plasma/applets/homerun/kicker/package/contents/ui/ItemListDelegate.qml b/plasma/applets/homerun/kicker/package/contents/ui/ItemListDelegate.qml deleted file mode 100644 index 34c96b31..00000000 --- a/plasma/applets/homerun/kicker/package/contents/ui/ItemListDelegate.qml +++ /dev/null @@ -1,302 +0,0 @@ -/* - * Copyright (C) 2013 by Eike Hein - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -import QtQuick 1.1 - -import org.kde.plasma.core 0.1 as PlasmaCore -import org.kde.plasma.components 0.1 as PlasmaComponents - -import org.kde.homerun.components 0.1 as HomerunComponents - -PlasmaComponents.ListItem { - height: itemHeight - - signal actionTriggered(string actionId, variant actionArgument) - signal aboutToShowActionMenu(variant actionMenu) - - property bool hasChildren: (listView.model != undefined && "modelForRow" in listView.model && listView.model.modelForRow(index).count) - property bool hasActionList: model.favoriteId || (("hasActionList" in model) && model.hasActionList) - - Keys.onPressed: { - if (!hasActionList) { - return; - } - - if (event.key == Qt.Key_M || event.key == Qt.Key_Menu) { - event.accepted = true; - openActionMenu(mouseArea); - } else if ((event.key == Qt.Key_Enter || event.key == Qt.Key_Return) && !hasChildren) { - if (!hasChildren) { - listView.model.trigger(index, "", null); - plasmoid.hidePopup(); - } - } - } - - MouseArea { - id: mouseArea - - anchors { - left: parent.left - right: parent.right - verticalCenter: parent.verticalCenter - } - - height: itemHeight - - property int mouseCol - - hoverEnabled: true - acceptedButtons: Qt.LeftButton | Qt.RightButton - - onClicked: { - if (!hasChildren) { - listView.model.trigger(index, "", null); - plasmoid.hidePopup(); - } - } - - onPressed: { - if (mouse.buttons & Qt.RightButton && hasActionList) { - openActionMenu(mouseArea, mouse.x, mouse.y); - } - } - - onPositionChanged: { - //FIXME: correct escape angle calc for right screen edge - if (justOpenedTimer.running || !hasChildren) { - listView.currentIndex = index; - } else { - mouseCol = mouse.x; - - var switchNow = false; - - if (index == currentIndex) { - updateCurrentItem(); - } else if ((index == currentIndex - 1) && mouse.y < (itemHeight - 6) - || (index == currentIndex + 1) && mouse.y > 5) { - - if ((childDialog != null && childDialog.leftOfParent) - ? mouse.x > listView.eligibleWidth - 5 : mouse.x < listView.eligibleWidth + 5) { - updateCurrentItem(); - } - } else if ((childDialog != null && childDialog.leftOfParent) - ? mouse.x > listView.eligibleWidth : mouse.x < listView.eligibleWidth) { - updateCurrentItem(); - } - - updateCurrentItemTimer.start(); - } - } - - onContainsMouseChanged: { - if (!containsMouse) { - updateCurrentItemTimer.stop(); - } - } - - function updateCurrentItem() { - listView.currentIndex = index; - listView.eligibleWidth = Math.min(width, mouseCol); - } - - Timer { - id: updateCurrentItemTimer - - interval: 50 - repeat: false - - onTriggered: parent.updateCurrentItem() - } - } - - Row { - anchors { - fill: parent - leftMargin: icon.visible ? 2 : 5 - } - - LayoutMirroring.enabled: (Qt.application.layoutDirection == Qt.RightToLeft) - - spacing: 5 - - PlasmaCore.IconItem { - id: icon - - anchors { - verticalCenter: parent.verticalCenter - } - - width: 0 - height: 0 - - visible: false - - active: mouseArea.containsMouse - - onSourceChanged: { - if (source && valid) { - visible = true; - width = theme.smallIconSize; - height = theme.smallIconSize; - } - } - - source: model.decoration - } - - Text { - width: parent.width - icon.width - icon.anchors.leftMargin - (arrow.visible ? arrow.width : 0) - (arrow.visible ? parent.spacing : 0) - (icon.visible ? parent.spacing : 0) - height: parent.height - - text: generateText() - - color: theme.textColor - elide: Text.ElideRight - verticalAlignment: lineCount > 1 ? Text.AlignTop : Text.AlignVCenter - horizontalAlignment: (Qt.application.layoutDirection == Qt.RightToLeft) ? Text.AlignRight : Text.AlignLeft - font.capitalization: theme.defaultFont.capitalization - font.family: theme.defaultFont.family - font.italic: theme.defaultFont.italic - font.letterSpacing: theme.defaultFont.letterSpacing - font.pointSize: theme.defaultFont.pointSize - font.strikeout: theme.defaultFont.strikeout - font.underline: theme.defaultFont.underline - font.weight: theme.defaultFont.weight - font.wordSpacing: theme.defaultFont.wordSpacing - - function generateText() { - if (nameFormat == 0) { - return model.display; - } else if ("genericName" in model && model.genericName != "" && model.genericName != model.display) { - if (nameFormat == 1) { - return model.genericName; - } else if (nameFormat == 2) { - return i18nc("App name (Generic name)", "%1 (%2)", model.display, model.genericName); - } else { - return i18nc("Generic Name (App name)", "%1 (%2)", model.genericName, model.display); - } - } - - return model.display; - } - } - - PlasmaCore.SvgItem { - id: arrow - - anchors { - verticalCenter: parent.verticalCenter - } - - width: theme.smallIconSize - height: theme.smallIconSize - - visible: (listView.currentIndex == index) && hasChildren - - svg: arrows - elementId: (Qt.application.layoutDirection == Qt.RightToLeft) ? "left-arrow" : "right-arrow" - } - } - - HomerunComponents.ActionMenu { - id: actionMenu - - onActionClicked: { - actionTriggered(actionId, actionArgument); - } - - onOpenedChanged: { - if (!opened) { - windowSystem.raiseParentWindow(listView); - } - } - } - - onAboutToShowActionMenu: { - fillActionMenu(actionMenu); - } - - onActionTriggered: { - triggerAction(model.index, actionId, actionArgument); - } - - function fillActionMenu(actionMenu) { - // Accessing actionList can be a costly operation, so we don't - // access it until we need the menu - - if ("containment" in listView.model) { - listView.model.containment = appletProxy.containment; - } - - var lst = model.hasActionList ? model.actionList : []; - var action = createFavoriteAction(); - if (action) { - if (lst.length > 0) { - var separator = { "type": "separator" }; - lst.unshift(action, separator); - } else { - lst = [action]; - } - } - actionMenu.actionList = lst; - } - - function createFavoriteAction() { - var favoriteModel = favoriteModelForFavoriteId(model.favoriteId); - if (favoriteModel === null) { - return null; - } - var action = {}; - if (favoriteModel.isFavorite(model.favoriteId)) { - action.text = i18n("Remove from Favorites"); - action.icon = QIcon("list-remove"); - action.actionId = "_homerun_favorite_remove"; - } else { - action.text = i18n("Add to Favorites"); - action.icon = QIcon("bookmark-new"); - action.actionId = "_homerun_favorite_add"; - } - action.actionArgument = {favoriteId: model.favoriteId, text: model.display}; - return action; - } - - function triggerAction(index, actionId, actionArgument) { - // Looks like String.startsWith does not exist in the JS interpreter we use :/ - function startsWith(txt, needle) { - return txt.substr(0, needle.length) === needle; - } - if (startsWith(actionId, "_homerun_favorite_")) { - handleFavoriteAction(actionId, actionArgument); - return; - } - - var closeRequested = listView.model.trigger(index, actionId, actionArgument); - - if (closeRequested) { - plasmoid.hidePopup(); - } - } - - function openActionMenu(visualParent, x, y) { - aboutToShowActionMenu(actionMenu); - actionMenu.visualParent = visualParent; - actionMenu.open(x, y); - } -} diff --git a/plasma/applets/homerun/kicker/package/contents/ui/ItemListDialog.qml b/plasma/applets/homerun/kicker/package/contents/ui/ItemListDialog.qml deleted file mode 100644 index 1196a1c7..00000000 --- a/plasma/applets/homerun/kicker/package/contents/ui/ItemListDialog.qml +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (C) 2013 by Eike Hein - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -import QtQuick 1.1 - -import org.kde.homerun.fixes 0.1 as HomerunFixes - -HomerunFixes.Dialog { - id: itemDialog - - property Item listView - - property bool leftOfParent: false - - visible: false - - location: Floating - windowFlags: Qt.WindowStaysOnTopHint - - mainItem: ItemListView { - id: itemListView - - dialog: itemDialog - - model: (itemDialog.parent.currentIndex != -1 && itemDialog.parent.model != undefined - && "modelForRow" in itemDialog.parent.model) ? - itemDialog.parent.model.modelForRow(itemDialog.parent.currentIndex) : undefined - - onModelChanged: { - if (model != undefined) { - updatePosition(); - } - } - } - - function delayedDestroy() { - var timer = Qt.createQmlObject('import QtQuick 1.1; Timer { onTriggered: itemDialog.destroy() }', itemDialog); - timer.interval = 0; - timer.start(); - } - - function updatePosition() { - if (parent.currentItem) { - syncMainItem(); - - var workArea = windowSystem.workArea(); - var pos = windowSystem.mapToScreen(parent, parent.currentItem.x, parent.currentItem.y); - - var xPos = pos.x + parent.width + margins.left; - - var workAreaWidth = workArea.x + workArea.width; - var availableWidth = workAreaWidth - xPos - margins.right; - - if (width > availableWidth) { - xPos = pos.x - width - margins.right; - leftOfParent = true; - } else { - leftOfParent = false; - } - - var yPos = pos.y - margins.top; - var menuHeight = itemListView.height; - - var workAreaHeight = workArea.y + workArea.height; - var availableHeight = workAreaHeight - yPos; - - if ((menuHeight + margins.bottom) > availableHeight) { - var adjust = menuHeight - Math.floor((availableHeight - margins.bottom) / itemListView.itemHeight) * itemListView.itemHeight; - yPos = yPos - adjust; - } - - x = xPos; - y = yPos; - } - } -} diff --git a/plasma/applets/homerun/kicker/package/contents/ui/ItemListView.qml b/plasma/applets/homerun/kicker/package/contents/ui/ItemListView.qml deleted file mode 100644 index 398876a1..00000000 --- a/plasma/applets/homerun/kicker/package/contents/ui/ItemListView.qml +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright (C) 2013 by Eike Hein - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -import QtQuick 1.1 - -import org.kde.plasma.components 0.1 as PlasmaComponents -import org.kde.plasma.extras 0.1 as PlasmaExtras -import org.kde.qtextracomponents 0.1 as QtExtra - -FocusScope { - id: itemList - - width: theme.defaultFont.mSize.width * ((nameFormat > 1) ? 20 : 18) - height: itemDialog.parent.childItemListHeight - - property Item dialog: null - property QtObject childDialog: null - property int childItemListHeight - - property bool containsMouse: mouseEventListener.containsMouse || (childDialog != null && childDialog.mainItem.containsMouse) - - property alias model: listView.model - property alias currentIndex: listView.currentIndex - property alias currentItem: listView.currentItem - - property int itemHeight: Math.max(theme.defaultFont.mSize.height, theme.smallIconSize) + listItemSvg.margins.top + listItemSvg.margins.bottom - - onFocusChanged: { - if (focus) { - main.focusChanged(); - } - } - - onContainsMouseChanged: { - if (!containsMouse) { - resetIndexTimer.start(); - } else { - resetIndexTimer.stop(); - } - } - - Timer { - id: dialogSpawnTimer - - interval: 70 - repeat: false - - onTriggered: { - if (!plasmoid.popupShowing) { - return; - } - - childDialog = itemListDialogComponent.createObject(itemList); - childDialog.setAttribute(Qt.WA_X11NetWmWindowTypeMenu, true) - childDialog.visible = true; - } - } - - Timer { - id: resetIndexTimer - - interval: (dialog != null) ? 50 : 150 - repeat: false - - onTriggered: { - if (focus) { - currentIndex = -1; - } - } - } - - QtExtra.MouseEventListener { - id: mouseEventListener - - anchors.fill: parent - - hoverEnabled: true - - onContainsMouseChanged: { - listView.eligibleWidth = listView.width; - } - - PlasmaExtras.ScrollArea { - anchors.fill: parent - - ListView { - id: listView - - property int eligibleWidth: width - - // HACK: Hack to work around bug in ScrollArea that causes the overflow - // deco to be visible when it shouldn't be. - contentHeight: itemList.height - 1 - - focus: true - - snapMode: ListView.SnapToItem - spacing: 0 - keyNavigationWraps: (dialog != null || itemList != sourcesList) - - model: itemList.model - delegate: ItemListDelegate {} - highlight: PlasmaComponents.Highlight { anchors.fill: listView.currentItem } - - onCountChanged: { - currentIndex = -1; - - // HACK: https://bugreports.qt-project.org/browse/QTBUG-20927 - // If you read this: This made me want to cry. - for (var i = 0; i < contentItem.children.length; ++i) - { - contentItem.children[i].y = i * itemHeight; - } - } - - onCurrentIndexChanged: { - if (currentIndex != -1) { - itemList.focus = true; - - if (currentItem != null && !currentItem.hasChildren || !plasmoid.popupShowing) { - return; - } - - if (childDialog) { - childDialog.visible = false; - childDialog.delayedDestroy(); - } - - if (model != undefined && "modelForRow" in model) { - var maxHeight = (Math.floor(windowSystem.workArea().height / itemHeight) - 1) * itemHeight; - childItemListHeight = Math.min(model.modelForRow(currentIndex).count * itemHeight, maxHeight); - } - - dialogSpawnTimer.restart(); - } else if (childDialog != null) { - dialogSpawnTimer.stop(); - childDialog.visible = false; - childDialog.delayedDestroy(); - childDialog = null; - } - } - - Keys.onPressed: { - if (event.key == Qt.Key_Right && childDialog != null) { - childDialog.mainItem.focus = true; - childDialog.mainItem.currentIndex = 0; - } else if (event.key == Qt.Key_Left && dialog != null) { - dialog.parent.focus = true; - dialog.destroy(); - } else if (event.key != Qt.Key_Escape && event.text != "") { - searchField.appendText(event.text); - } - } - - function focusChanged() { - if (!itemList.focus && listView.currentIndex != -1 && childDialog == null) { - listView.currentIndex = -1; - } - } - - Component.onCompleted: { - main.focusChanged.connect(focusChanged); - } - - Component.onDestruction: { - main.focusChanged.disconnect(focusChanged); - } - } - } - } -} diff --git a/plasma/applets/homerun/kicker/package/contents/ui/PopupButton.qml b/plasma/applets/homerun/kicker/package/contents/ui/PopupButton.qml deleted file mode 100644 index 6603872a..00000000 --- a/plasma/applets/homerun/kicker/package/contents/ui/PopupButton.qml +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (C) 2013 by Eike Hein - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -import QtQuick 1.1 - -import org.kde.plasma.core 0.1 as PlasmaCore - -Item { - property bool vertical: (plasmoid.formFactor == Vertical) - - PlasmaCore.IconItem { - id: buttonIcon - - anchors.fill: parent - - visible: !(main.useCustomButtonImage && main.buttonImage) - - source: main.icon - active: mouseArea.containsMouse - - onWidthChanged: { - if (vertical && visible) { - plasmoid.setMinimumSize(theme.smallIconSize, parent.width); - } - } - - onHeightChanged: { - if (!vertical && visible) { - plasmoid.setMinimumSize(parent.height, theme.smallIconSize); - } - } - - onVisibleChanged: { - if (visible) { - if (vertical) { - plasmoid.setMinimumSize(theme.smallIconSize, parent.width); - } else { - plasmoid.setMinimumSize(parent.height, theme.smallIconSize); - } - } - } - } - - Image { - id: buttonImage - - width: vertical ? parent.width : undefined - height: vertical ? undefined : parent.height - - onPaintedWidthChanged: { - if (!vertical && visible) { - plasmoid.setMinimumSize(paintedWidth, theme.smallIconSize); - } - } - - onPaintedHeightChanged: { - if (vertical && visible) { - plasmoid.setMinimumSize(theme.smallIconSize, paintedHeight); - } - } - - onVisibleChanged: { - if (visible) { - if (vertical) { - plasmoid.setMinimumSize(theme.smallIconSize, paintedHeight); - } else { - plasmoid.setMinimumSize(paintedWidth, theme.smallIconSize); - } - } - } - - visible: main.useCustomButtonImage && main.buttonImage - source: main.buttonImage - fillMode: Image.PreserveAspectFit - smooth: true - } - - MouseArea - { - id: mouseArea - - anchors.fill: parent - - hoverEnabled: true - - onClicked: { - if (plasmoid.popupShowing) { - plasmoid.hidePopup(); - } else { - plasmoid.showPopup(); - } - } - } -} diff --git a/plasma/applets/homerun/kicker/package/contents/ui/SidebarItem.qml b/plasma/applets/homerun/kicker/package/contents/ui/SidebarItem.qml deleted file mode 100644 index f2fca0e0..00000000 --- a/plasma/applets/homerun/kicker/package/contents/ui/SidebarItem.qml +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (C) 2013 by Eike Hein - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -import QtQuick 1.1 - -import org.kde.plasma.core 0.1 as PlasmaCore -import org.kde.draganddrop 1.0 as DragAndDrop -import org.kde.qtextracomponents 0.1 as QtExtra - -import org.kde.homerun.components 0.1 as HomerunComponents -import org.kde.homerun.kicker 0.1 as HomerunKicker - -DragAndDrop.DragArea { - id: sidebarItem - - width: parent.width - height: width - - signal actionTriggered(string actionId, variant actionArgument) - signal aboutToShowActionMenu(variant actionMenu) - - property bool edgeItem: (y < parent.height && y + height > parent.height) - - property int itemIndex: model.index - property bool hasActionList: model.favoriteId || (("hasActionList" in model) && model.hasActionList) - - delegateImage: model.decoration - supportedActions: Qt.MoveAction - - mimeData { - source: sidebarItem - } - - QtExtra.MouseEventListener { - id: listener - - anchors.fill: parent - - hoverEnabled: true - - onClicked: { - repeater.model.trigger(index, "", null); - plasmoid.hidePopup(); - } - - onPressed: { - if (mouse.buttons & Qt.RightButton && hasActionList) { - openActionMenu(sidebarItem, mouse.x, mouse.y); - } - } - } - - HomerunKicker.FadeOutItem { - anchors.fill: parent - - covered: edgeItem ? (sidebarItem.y + height - sidebarItem.parent.height) : 0 - - PlasmaCore.IconItem { - anchors.fill: parent - - active: listener.containsMouse - - source: model.decoration - } - } - - HomerunComponents.ActionMenu { - id: actionMenu - - onActionClicked: { - actionTriggered(actionId, actionArgument); - } - } - - onAboutToShowActionMenu: { - fillActionMenu(actionMenu); - } - - onActionTriggered: { - triggerAction(model.index, actionId, actionArgument); - } - - function fillActionMenu(actionMenu) { - // Accessing actionList can be a costly operation, so we don't - // access it until we need the menu - var lst = model.hasActionList ? model.actionList : []; - var action = createFavoriteAction(); - if (action) { - if (lst.length > 0) { - var separator = { "type": "separator" }; - lst.unshift(action, separator); - } else { - lst = [action]; - } - } - actionMenu.actionList = lst; - } - - function createFavoriteAction() { - var favoriteModel = favoriteModelForFavoriteId(model.favoriteId); - if (favoriteModel === null) { - return null; - } - var action = {}; - if (favoriteModel.isFavorite(model.favoriteId)) { - action.text = i18n("Remove from Favorites"); - action.icon = QIcon("list-remove"); - action.actionId = "_homerun_favorite_remove"; - } else { - action.text = i18n("Add to Favorites"); - action.icon = QIcon("bookmark-new"); - action.actionId = "_homerun_favorite_add"; - } - action.actionArgument = {favoriteId: model.favoriteId, text: model.display}; - return action; - } - - function triggerAction(index, actionId, actionArgument) { - // Looks like String.startsWith does not exist in the JS interpreter we use :/ - function startsWith(txt, needle) { - return txt.substr(0, needle.length) === needle; - } - if (startsWith(actionId, "_homerun_favorite_")) { - handleFavoriteAction(actionId, actionArgument); - return; - } - - var closeRequested = repeater.model.trigger(index, actionId, actionArgument); - - if (closeRequested) { - plasmoid.hidePopup(); - } - } - - function openActionMenu(visualParent, x, y) { - aboutToShowActionMenu(actionMenu); - actionMenu.visualParent = visualParent; - actionMenu.open(x, y); - } -} diff --git a/plasma/applets/homerun/kicker/package/contents/ui/SidebarSection.qml b/plasma/applets/homerun/kicker/package/contents/ui/SidebarSection.qml deleted file mode 100644 index f874bf9c..00000000 --- a/plasma/applets/homerun/kicker/package/contents/ui/SidebarSection.qml +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (C) 2013 by Eike Hein - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -import QtQuick 1.1 - -import org.kde.draganddrop 1.0 as DragAndDrop - -DragAndDrop.DropArea { - id: sidebarSection - - property alias model: repeater.model - - onDragMove: { - if (flow.animating) { - return; - } - - var above = flow.childAt(event.x, event.y); - - if (above && above != event.mimeData.source) { - repeater.model.moveRow(event.mimeData.source.itemIndex, above.itemIndex); - } - } - - Flow { - id: flow - - anchors.fill: parent - - property bool animating: false - property int animationDuration: resetAnimationDurationTimer.interval - - clip: true - - move: Transition { - SequentialAnimation { - PropertyAction { target: flow; property: "animating"; value: true } - - NumberAnimation { - duration: flow.animationDuration - properties: "x, y" - easing.type: Easing.OutQuad - } - - PropertyAction { target: flow; property: "animating"; value: false } - } - } - - spacing: main.spacing - - Repeater { - id: repeater - - delegate: SidebarItem {} - - onCountChanged: { - flow.animationDuration = 0; - resetAnimationDurationTimer.start(); - } - } - } - - Timer { - id: resetAnimationDurationTimer - - interval: 150 - repeat: false - - onTriggered: { - flow.animationDuration = interval - 20; - } - } -} diff --git a/plasma/applets/homerun/kicker/package/contents/ui/config.ui b/plasma/applets/homerun/kicker/package/contents/ui/config.ui deleted file mode 100644 index 7212ef25..00000000 --- a/plasma/applets/homerun/kicker/package/contents/ui/config.ui +++ /dev/null @@ -1,204 +0,0 @@ - - - homerunkickerConfig - - - - 0 - 0 - 301 - 162 - - - - - 0 - - - - - - 75 - true - - - - Behavior - - - - - - - Search bookmarks and files: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - kcfg_runnerSupport - - - - - - - If this option is enabled, search may display additional columns with search results powered by certain Plasma runner plugins, such as "Bookmarks" and "Desktop Search". - - - - - - - - - - - 75 - true - - - - Appearance - - - - - - - Custom button image: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - kcfg_useCustomButtonImage - - - - - - - - - - - - - - - - false - - - *.jpg *.png *.xpm *.gif *.webp - - - - - - - - - Align contents to bottom: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - kcfg_alignToBottom - - - - - - - - - - - - - - Show applications as: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - kcfg_nameFormat - - - - - - - - 0 - 0 - - - - - Name only - - - - - Description only - - - - - Name (Description) - - - - - Description (Name) - - - - - - - - Qt::Vertical - - - - 20 - 204 - - - - - - - - - KUrlRequester - QFrame -
kurlrequester.h
-
-
- - - - kcfg_useCustomButtonImage - toggled(bool) - kcfg_buttonImage - setEnabled(bool) - - - 163 - 111 - - - 236 - 111 - - - - -
diff --git a/plasma/applets/homerun/kicker/package/contents/ui/main.qml b/plasma/applets/homerun/kicker/package/contents/ui/main.qml deleted file mode 100644 index 8d89a06a..00000000 --- a/plasma/applets/homerun/kicker/package/contents/ui/main.qml +++ /dev/null @@ -1,573 +0,0 @@ -/* - * Copyright (C) 2013 by Eike Hein - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -import QtQuick 1.1 - -import org.kde.plasma.core 0.1 as PlasmaCore - -import org.kde.homerun.components 0.1 as HomerunComponents -import org.kde.homerun.kicker 0.1 as HomerunKicker -import org.kde.homerun.fixes 0.1 as HomerunFixes - -Item { - id: main - - signal focusChanged() - - property int minimumWidth: mainRow.implicitWidth + mainRow.anchors.leftMargin + mainRow.anchors.rightMargin - property int maximumWidth: minimumWidth - property int preferredWidth: minimumWidth - - property int minimumHeight: preferredHeight - property int maximumHeight: windowSystem.workArea().height - property int preferredHeight: (sourcesModel.count * sourcesList.itemHeight) + searchField.height + main.spacing + mainRow.anchors.topMargin + mainRow.anchors.bottomMargin - - property variant location: plasmoid.location // HACK: plasmoid.location doesn't work as a notifyable - // property for some reason. We attach to locationChanged - // in Component.onCompleted. - property bool atTopEdge: (location == TopEdge) - - property int spacing: 6 - - property string configFileName: "homerunkickerrc" - property QtObject recentAppsModel - property QtObject allAppsModel - property QtObject runnerModel - - property string icon: plasmoid.readConfig("icon") - property bool runnerSupport: true - property bool useCustomButtonImage: false - property string buttonImage: "" - property bool alignToBottom: true - property int nameFormat: 0 - - property QtObject itemListDialogComponent: Qt.createComponent("ItemListDialog.qml"); - - property Component compactRepresentation: PopupButton { id: button } - - function configChanged() { - icon = plasmoid.readConfig("icon"); - runnerSupport = plasmoid.readConfig("runnerSupport"); - useCustomButtonImage = plasmoid.readConfig("useCustomButtonImage"); - buttonImage = urlConverter.convertToPath(plasmoid.readConfig("buttonImage")); - alignToBottom = plasmoid.readConfig("alignToBottom"); - nameFormat = plasmoid.readConfig("nameFormat"); - } - - function updateLocation() { - location = plasmoid.location; - } - - function updateSvgMetrics() { - lineSvg.horLineHeight = lineSvg.elementSize("horizontal-line").height; - lineSvg.vertLineWidth = lineSvg.elementSize("vertical-line").width; - } - - function showPopup(shown) { - if (shown) { - maximumHeight = windowSystem.workArea().height; - justOpenedTimer.start(); - searchField.focus = true; - } else { - sourcesList.currentIndex = -1; - searchField.text = ""; - } - } - - function favoriteModelForFavoriteId(favoriteId) { - if (favoriteId === undefined || favoriteId === "") { - return null; - } - var lst = favoriteId.split(":"); - if (lst.length === 0) { - return null; - } - var model = sourceRegistry.favoriteModels[lst[0]]; - if (model === undefined) { - return null; - } else { - return model; - } - } - - function handleFavoriteAction(actionId, actionArgument) { - var favoriteId = actionArgument.favoriteId; - var favoriteModel = favoriteModelForFavoriteId(favoriteId); - if (actionId == "_homerun_favorite_remove") { - favoriteModel.removeFavorite(favoriteId); - } else if (actionId == "_homerun_favorite_add") { - favoriteModel.addFavorite(favoriteId); - } - } - - function action_menuedit() { - processRunner.execute("kmenuedit"); - } - - Timer { - id: justOpenedTimer - - repeat: false - interval: 600 - } - - HomerunKicker.AppletProxy { - id: appletProxy - item: plasmoid.action("configure") - } - - HomerunComponents.TabModel { - id: tabModel - configFileName: main.configFileName - sourceRegistry: sourceRegistry - } - - HomerunComponents.SourceRegistry { - id: sourceRegistry - configFileName: main.configFileName - } - - HomerunKicker.ProcessRunner { - id: processRunner - } - - HomerunKicker.UrlConverter { - id: urlConverter - } - - HomerunKicker.WindowSystem { - id: windowSystem - } - - PlasmaCore.FrameSvgItem { - id : listItemSvg - - visible: false - - imagePath: "widgets/listitem" - prefix: "normal" - } - - PlasmaCore.Svg { - id: arrows - - imagePath: "widgets/arrows" - size: "16x16" - } - - PlasmaCore.Svg { - id: lineSvg - imagePath: "widgets/line" - - property int horLineHeight - property int vertLineWidth - } - - Item { - anchors.fill: parent - - Row { - id: mainRow - - anchors { - fill: parent - leftMargin: 4; - topMargin: (location == TopEdge) ? 3 : 1; - rightMargin: (location == RightEdge) ? 3 : 1; - bottomMargin: (location == BottomEdge) ? 3 : 1; - } - - spacing: main.spacing - - LayoutMirroring.enabled: (location == RightEdge) || (Qt.application.layoutDirection == Qt.RightToLeft) - - PlasmaCore.FrameSvgItem { - id: frame - - width: theme.mediumIconSize + theme.smallIconSize - height: parent.height - - imagePath: "widgets/listitem" - prefix: "normal" - - SidebarSection { - id: favoriteApps - - x: theme.smallIconSize / 2 - y: atTopEdge ? sidebarSeparator.y + sidebarSeparator.height + main.spacing : theme.smallIconSize / 2 - - width: parent.width - theme.smallIconSize - height: (parent.height - sidebarSeparator.height - powerSessionFavorites.height - - (2 * main.spacing) - (2 * (theme.smallIconSize / 2))) - } - - PlasmaCore.SvgItem { - id: sidebarSeparator - - x: theme.smallIconSize / 2 - y: ((atTopEdge ? powerSessionFavorites.y + powerSessionFavorites.height : favoriteApps.y - + favoriteApps.height) + main.spacing) - - width: parent.width - theme.smallIconSize - height: lineSvg.horLineHeight - - svg: lineSvg - elementId: "horizontal-line" - } - - SidebarSection { - id: powerSessionFavorites - - x: theme.smallIconSize / 2 - y: atTopEdge ? theme.smallIconSize / 2 : sidebarSeparator.y + sidebarSeparator.height + main.spacing - - width: parent.width - theme.smallIconSize - height: (model.count * width) + ((model.count - 1) * main.spacing) - } - } - - Row { - height: parent.height - - Item { - width: sourcesList.width - height: parent.height - - ItemListView { - id: sourcesList - - anchors { - top: atTopEdge ? searchField.bottom : undefined - topMargin: atTopEdge ? main.spacing : 0 - bottom: atTopEdge ? undefined : searchField.top - bottomMargin: atTopEdge ? 0 : main.spacing - } - - width: theme.defaultFont.mSize.width * 18 - height: main.alignToBottom ? Math.min(model.count * itemHeight, - parent.height - searchField.height - anchors.topMargin - anchors.bottomMargin) - : parent.height - searchField.height - anchors.topMargin - anchors.bottomMargin - - model: (searchField.text != "") ? allAppsModel : sourcesModel - - KeyNavigation.up: searchField - KeyNavigation.down: searchField - - Keys.onPressed: { - if (!runnerItemsColumns.count) { - return; - } - - var target = null; - - if (event.key == Qt.Key_Right) { - target = runnerItemsColumns.itemAt(0).listView; - } else if (event.key == Qt.Key_Left) { - target = runnerItemsColumns.itemAt(runnerItemsColumns.count - 1).listView; - } - - if (target) { - currentIndex = -1; - target.currentIndex = 0; - } - } - } - - HomerunFixes.TextField { - id: searchField - - y: atTopEdge ? frame.y : (frame.y + frame.height) - height - 1 - - anchors { - horizontalCenter: parent.horizontalCenter - } - - width: parent.width - - clearButtonShown: true - placeholderText: i18n("Search...") - - onFocusChanged: { - if (focus) { - sourcesList.currentIndex = -1; - } - } - - onAccepted: { - if (allAppsModel && allAppsModel.count) { - allAppsModel.trigger(0, "", null); - } - - plasmoid.hidePopup(); - } - - Keys.onPressed: { - if (!sourcesList.model.count) { - return; - } - - if (event.key == Qt.Key_Up) { - sourcesList.currentIndex = Math.floor(sourcesList.height / sourcesList.itemHeight) - 1; - } else if (event.key == Qt.Key_Down) { - sourcesList.currentIndex = 0; - } - } - - function appendText(newText) { - focus = true; - text = text + newText; - } - } - } - - Repeater { - id: runnerItemsColumns - - model: runnerSupport ? runnerModel : null - - delegate: Item { - property Item listView: itemList - - width: lineSvg.vertLineWidth + sourcesList.width + (main.spacing * 2) - height: mainRow.height - - PlasmaCore.SvgItem { - id: vertLine - - anchors { - left: parent.left - leftMargin: main.spacing - } - - width: lineSvg.vertLineWidth - height: parent.height - - svg: lineSvg - elementId: "vertical-line" - } - - PlasmaCore.FrameSvgItem { - id: headerLabel - - anchors { - left: vertLine.right - leftMargin: main.spacing - } - - width: itemList.width - height: searchField.height - - imagePath: "widgets/listitem" - prefix: "normal" - - Text { - anchors.fill: parent - text: model.display - - color: theme.textColor - elide: Text.ElideRight - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - font.capitalization: theme.defaultFont.capitalization - font.family: theme.defaultFont.family - font.italic: theme.defaultFont.italic - font.letterSpacing: theme.defaultFont.letterSpacing - font.pointSize: theme.defaultFont.pointSize - font.strikeout: theme.defaultFont.strikeout - font.underline: theme.defaultFont.underline - font.weight: Font.Bold - font.wordSpacing: theme.defaultFont.wordSpacing - } - } - - ItemListView { - id: itemList - - anchors { - left: vertLine.right - leftMargin: main.spacing - top: atTopEdge ? headerLabel.bottom : undefined - topMargin: atTopEdge ? main.spacing : 0 - bottom: atTopEdge ? undefined : parent.bottom - bottomMargin: atTopEdge ? 0 : Math.max(0, mainRow.height - sourcesList.y - sourcesList.height - itemHeight) - } - - width: sourcesList.width - height: model ? (main.alignToBottom ? - Math.min(model.count * itemHeight, parent.height - headerLabel.height - anchors.topMargin - anchors.bottomMargin) - : parent.height - headerLabel.height - anchors.topMargin - anchors.bottomMargin) : 0 - - model: runnerItemsColumns.model.modelForRow(index); - - Keys.onPressed: { - var target = null; - - if (event.key == Qt.Key_Right) { - if (index < (runnerItemsColumns.count - 1)) { - target = runnerItemsColumns.itemAt(index + 1).listView; - } else { - target = sourcesList; - } - } else if (event.key == Qt.Key_Left) { - if (index == 0) { - target = sourcesList; - } else { - target = runnerItemsColumns.itemAt(index - 1).listView; - } - } - - if (target) { - currentIndex = -1; - target.currentIndex = 0; - } - } - } - } - } - } - } - } - - Binding { - target: plasmoid - property: "passivePopup" - value: sourcesList.containsMouse - } - - HomerunKicker.SourceListModel { - id: sourcesModel - } - - Repeater { - model: tabModel - delegate: Item { - property QtObject sourceModel: model.sourceModel - - Repeater { - model: sourceModel - - delegate: sourceDelegate - } - } - } - - Component { - id: sourceDelegate - - Item { - id: sourceDelegateMain - - Component.onCompleted: { - var sourceName = sourceRegistry.visibleNameForSource(model.sourceId); - - if ("modelForRow" in model.model) { - if (model.sourceId == "FilterableInstalledApps") { - queryBindingComponent.createObject(sourceDelegateMain, {"target": model.model}); - multiModelExpander.createObject(sourceDelegateMain, {"display": sourceName, - "model": model.model}); - model.model.applicationLaunched.connect(recentAppsModel.addApp); - } else if (model.sourceId == "Runner") { - runnerQueryBindingComponent.createObject(sourceDelegateMain, {"target": model.model}); - runnerModel = model.model; - } - } else if (model.sourceId == "FavoriteApps") { - favoriteApps.model = model.model; - } else { - if (model.sourceId == "CombinedPowerSession") { - model.model.showFavoritesActions = true; - powerSessionFavorites.model = model.model.favoritesModel(); - } else if (model.sourceId == "RecentApps") { - recentAppsModel = model.model; - } - - // FIXME: KPluginInfo::name() doesn't load the translation from the .desktop - // file for some reason, probably due to yet another i18n bug in KConfig (bad - // memories of debugging a similar problem with dfaure once ...). Let's paper - // over it for release by falling back to the gettext catalog. - if (model.sourceId == "RecentDocuments") { - sourceName = i18n("Recent Documents"); - } - - sourcesModel.appendSource(sourceName, model.model); - } - } - } - } - - Component { - id: queryBindingComponent - Binding { - property: "query" - value: searchField.text - } - } - - Component { - id: runnerQueryBindingComponent - Binding { - property: "query" - value: searchField.text - when: main.runnerSupport - } - } - - Component { - id: multiModelExpander - - Repeater { - width: 0 - height: 0 - - visible: false - - property string display - - delegate: Item { property string display: model.display } - - onItemAdded: { - var mdl = model.modelForRow(index); - - if (index == 0) { - allAppsModel = mdl; - } else { - sourcesModel.insertSource(index, item.display, mdl); - } - } - } - } - - Component.onCompleted: { - plasmoid.addEventListener('ConfigChanged', configChanged); - plasmoid.popupEvent.connect(showPopup); - plasmoid.aspectRatioMode = IgnoreAspectRatio; - updateSvgMetrics(); - theme.themeChanged.connect(updateSvgMetrics); - - // HACK: See location prop. - plasmoid.locationChanged.connect(updateLocation); - - var data = new Object; - data["image"] = "homerun"; - data["mainText"] = i18n("Homerun Kicker"); - data["subText"] = i18n("Launch applications and manage your desktop."); - plasmoid.popupIconToolTip = data; - - plasmoid.setAction("menuedit", i18n("Edit Applications...")); - } -} diff --git a/plasma/applets/homerun/kicker/package/metadata.desktop.cmake b/plasma/applets/homerun/kicker/package/metadata.desktop.cmake deleted file mode 100644 index dd6ccca1..00000000 --- a/plasma/applets/homerun/kicker/package/metadata.desktop.cmake +++ /dev/null @@ -1,61 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Name=Homerun Kicker -Name[ca]=Kicker Homerun -Name[ca@valencia]=Kicker Homerun -Name[da]=Homerun-kicker -Name[de]=Homerun-Kicker -Name[el]=Homerun Kicker -Name[es]=Homerun Kicker -Name[fi]=Homerun Kicker -Name[fr]=Lanceur de Homerun -Name[hu]=Homerun kirúgó -Name[it]=Kicker di Homerun -Name[ko]=Homerun Kicker -Name[nl]=Programmastarter Homerun -Name[pl]=Program uruchamiający Homerun -Name[pt]=Homerun Kicker -Name[pt_BR]=Homerun Kicker -Name[sk]=Spúšťač Homerun -Name[sl]=Majhen zaganjalnik Homerun -Name[sv]=Homerun startprogram -Name[tr]=Homerun Kicker -Name[uk]=Меню Homerun -Name[x-test]=xxHomerun Kickerxx -Comment=Non-fullscreen version of Homerun -Comment[ca]=Versió de Homerun sense pantalla completa -Comment[ca@valencia]=Versió de Homerun sense pantalla completa -Comment[da]=Ikke-fuldskærm version af Homerun -Comment[de]=Nicht-Vollbildversion von Homerun -Comment[el]=Έκδοση του Homerun χωρίς πλήρη οθόνη -Comment[es]=Versión no a pantalla completa de Homerun -Comment[fi]=Homerunin versio, joka ei vie koko näyttöä -Comment[fr]=Version de Homerun non plein-écran -Comment[hu]=A Homerun nem teljes képernyős verziója -Comment[it]=Versione di Homerun a schermo ridotto -Comment[ko]=Homerun의 창 모드 버전 -Comment[nl]=Versie van Homerun zonder volledig scherm -Comment[pl]=Wersja niepełnoekranowa Homerun -Comment[pt]=Versão em ecrã não-completo do Homerun -Comment[pt_BR]=Versão do Homerun em janela -Comment[sk]=Neplnoobrazovková verzia Homerun -Comment[sl]=Različica Homeruna, ki ni celozaslonska -Comment[sv]=Version av Homerun utan fullskärmsläge -Comment[tr]=Homerun'ın tam ekran olmayan sürümü -Comment[uk]=Неповноекранна версія Homerun -Comment[x-test]=xxNon-fullscreen version of Homerunxx - -Icon=homerun -Type=Service -X-KDE-ServiceTypes=Plasma/Applet,Plasma/PopupApplet - -X-Plasma-API=declarativeappletscript -X-Plasma-MainScript=ui/main.qml -X-KDE-PluginInfo-Author=Homerun Developers -X-KDE-PluginInfo-Name=org.kde.homerun-kicker -X-KDE-PluginInfo-Version=@HOMERUN_VERSION@ -X-KDE-PluginInfo-Website=http://userbase.kde.org/Homerun -X-KDE-PluginInfo-Category=Application Launchers -X-KDE-PluginInfo-Depends= -X-KDE-PluginInfo-License=GPL v2+ -X-KDE-PluginInfo-EnabledByDefault=true diff --git a/plasma/applets/homerun/lib/CMakeLists.txt b/plasma/applets/homerun/lib/CMakeLists.txt deleted file mode 100644 index 3e4c878d..00000000 --- a/plasma/applets/homerun/lib/CMakeLists.txt +++ /dev/null @@ -1,87 +0,0 @@ -project(lib) - -## Lib version -### Bump this one when a binary-incompatible change is introduced -set(lib_VERSION_MAJOR 0) - -### Bump this one when the API is extended in a binary-compatible way -set(lib_VERSION_MINOR 0) - -### Bump this one when changes do not extend the API -set(lib_VERSION_PATCH 0) - -set(lib_VERSION ${lib_VERSION_MAJOR}.${lib_VERSION_MINOR}.${lib_VERSION_PATCH}) - -set(lib_SRCS - abstractsource.cpp - actionlist.cpp - pathmodel.cpp - sourceconfigurationwidget.cpp - ) - -# Build -include_directories( - ${CMAKE_CURRENT_SOURCE_DIR} - ${LIBKONQ_INCLUDE_DIR} -) - -configure_file(libhomerun_config.h.in ${CMAKE_CURRENT_BINARY_DIR}/libhomerun_config.h @ONLY) - -add_library(homerun SHARED ${lib_SRCS}) -set_target_properties(homerun PROPERTIES - VERSION ${lib_VERSION} - SOVERSION ${lib_VERSION_MAJOR} -) - -target_link_libraries(homerun - ${QT_QTCORE_LIBRARY} - ${QT_QTGUI_LIBRARY} - ${KDE4_KDECORE_LIBS} - ${KDE4_KDEUI_LIBS} - ${KDE4_KIO_LIBS} - ${LIBKONQ_LIBRARY} -) - -# Doxygen -configure_file(Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY) -add_custom_target(dox COMMAND - doxygen -) - -# Install -## Headers -install(DIRECTORY . - DESTINATION include/homerun - FILES_MATCHING PATTERN "*.h" - ) - -## .so -install(TARGETS homerun - EXPORT HomerunTargets - ${INSTALL_TARGETS_DEFAULT_ARGS} - ) - -## CMakeConfig -install(EXPORT HomerunTargets - DESTINATION ${LIB_INSTALL_DIR}/cmake/Homerun - FILE HomerunTargets.cmake - ) - -configure_file( - HomerunConfig.cmake.in - ${CMAKE_CURRENT_BINARY_DIR}/HomerunConfig.cmake - @ONLY) - -macro_write_basic_cmake_version_file( - ${CMAKE_CURRENT_BINARY_DIR}/HomerunConfigVersion.cmake - ${lib_VERSION_MAJOR} ${lib_VERSION_MINOR} ${lib_VERSION_PATCH} - ) - -INSTALL(FILES - ${CMAKE_CURRENT_BINARY_DIR}/HomerunConfig.cmake - ${CMAKE_CURRENT_BINARY_DIR}/HomerunConfigVersion.cmake - DESTINATION ${LIB_INSTALL_DIR}/cmake/Homerun - ) - -## Desktop file -install(FILES homerun-source.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR}) diff --git a/plasma/applets/homerun/lib/Doxyfile.in b/plasma/applets/homerun/lib/Doxyfile.in deleted file mode 100644 index 22e6d325..00000000 --- a/plasma/applets/homerun/lib/Doxyfile.in +++ /dev/null @@ -1,288 +0,0 @@ -# Doxyfile 1.8.1.2 - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- -DOXYFILE_ENCODING = UTF-8 -PROJECT_NAME = "Homerun" -PROJECT_NUMBER = @HOMERUN_VERSION@ -PROJECT_BRIEF = -PROJECT_LOGO = -OUTPUT_DIRECTORY = -CREATE_SUBDIRS = NO -OUTPUT_LANGUAGE = English -BRIEF_MEMBER_DESC = YES -REPEAT_BRIEF = YES -ABBREVIATE_BRIEF = -ALWAYS_DETAILED_SEC = NO -INLINE_INHERITED_MEMB = NO -FULL_PATH_NAMES = YES -STRIP_FROM_PATH = -STRIP_FROM_INC_PATH = -SHORT_NAMES = NO -JAVADOC_AUTOBRIEF = NO -QT_AUTOBRIEF = NO -MULTILINE_CPP_IS_BRIEF = NO -INHERIT_DOCS = YES -SEPARATE_MEMBER_PAGES = NO -TAB_SIZE = 4 -ALIASES = -TCL_SUBST = -OPTIMIZE_OUTPUT_FOR_C = NO -OPTIMIZE_OUTPUT_JAVA = NO -OPTIMIZE_FOR_FORTRAN = NO -OPTIMIZE_OUTPUT_VHDL = NO -EXTENSION_MAPPING = -MARKDOWN_SUPPORT = YES -BUILTIN_STL_SUPPORT = NO -CPP_CLI_SUPPORT = NO -SIP_SUPPORT = NO -IDL_PROPERTY_SUPPORT = YES -DISTRIBUTE_GROUP_DOC = NO -SUBGROUPING = YES -INLINE_GROUPED_CLASSES = NO -INLINE_SIMPLE_STRUCTS = NO -TYPEDEF_HIDES_STRUCT = NO -SYMBOL_CACHE_SIZE = 0 -LOOKUP_CACHE_SIZE = 0 -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- -EXTRACT_ALL = NO -EXTRACT_PRIVATE = NO -EXTRACT_PACKAGE = NO -EXTRACT_STATIC = NO -EXTRACT_LOCAL_CLASSES = YES -EXTRACT_LOCAL_METHODS = NO -EXTRACT_ANON_NSPACES = NO -HIDE_UNDOC_MEMBERS = NO -HIDE_UNDOC_CLASSES = NO -HIDE_FRIEND_COMPOUNDS = NO -HIDE_IN_BODY_DOCS = NO -INTERNAL_DOCS = NO -CASE_SENSE_NAMES = YES -HIDE_SCOPE_NAMES = NO -SHOW_INCLUDE_FILES = YES -FORCE_LOCAL_INCLUDES = NO -INLINE_INFO = YES -SORT_MEMBER_DOCS = YES -SORT_BRIEF_DOCS = NO -SORT_MEMBERS_CTORS_1ST = NO -SORT_GROUP_NAMES = NO -SORT_BY_SCOPE_NAME = NO -STRICT_PROTO_MATCHING = NO -GENERATE_TODOLIST = NO -GENERATE_TESTLIST = NO -GENERATE_BUGLIST = NO -GENERATE_DEPRECATEDLIST= YES -ENABLED_SECTIONS = -MAX_INITIALIZER_LINES = 30 -SHOW_USED_FILES = YES -SHOW_FILES = YES -SHOW_NAMESPACES = YES -FILE_VERSION_FILTER = -LAYOUT_FILE = -CITE_BIB_FILES = -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- -QUIET = NO -WARNINGS = YES -WARN_IF_UNDOCUMENTED = YES -WARN_IF_DOC_ERROR = YES -WARN_NO_PARAMDOC = NO -WARN_FORMAT = "$file:$line: $text" -WARN_LOGFILE = -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = @CMAKE_CURRENT_SOURCE_DIR@ -INPUT_ENCODING = UTF-8 -FILE_PATTERNS = *.h *.dox *.md -RECURSIVE = NO -EXCLUDE = homerun_export.h -EXCLUDE_SYMLINKS = NO -EXCLUDE_PATTERNS = -EXCLUDE_SYMBOLS = -EXAMPLE_PATH = -EXAMPLE_PATTERNS = -EXAMPLE_RECURSIVE = NO -IMAGE_PATH = -INPUT_FILTER = -FILTER_PATTERNS = -FILTER_SOURCE_FILES = NO -FILTER_SOURCE_PATTERNS = -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- -SOURCE_BROWSER = NO -INLINE_SOURCES = NO -STRIP_CODE_COMMENTS = YES -REFERENCED_BY_RELATION = NO -REFERENCES_RELATION = NO -REFERENCES_LINK_SOURCE = YES -USE_HTAGS = NO -VERBATIM_HEADERS = YES -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- -ALPHABETICAL_INDEX = YES -COLS_IN_ALPHA_INDEX = 5 -IGNORE_PREFIX = -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- -GENERATE_HTML = YES -HTML_OUTPUT = html -HTML_FILE_EXTENSION = .html -HTML_HEADER = -HTML_FOOTER = -HTML_STYLESHEET = -HTML_EXTRA_FILES = -HTML_COLORSTYLE_HUE = 220 -HTML_COLORSTYLE_SAT = 100 -HTML_COLORSTYLE_GAMMA = 80 -HTML_TIMESTAMP = YES -HTML_DYNAMIC_SECTIONS = NO -HTML_INDEX_NUM_ENTRIES = 100 -GENERATE_DOCSET = NO -DOCSET_FEEDNAME = "Doxygen generated docs" -DOCSET_BUNDLE_ID = org.doxygen.Project -DOCSET_PUBLISHER_ID = org.doxygen.Publisher -DOCSET_PUBLISHER_NAME = Publisher -GENERATE_HTMLHELP = NO -CHM_FILE = -HHC_LOCATION = -GENERATE_CHI = NO -CHM_INDEX_ENCODING = -BINARY_TOC = NO -TOC_EXPAND = NO -GENERATE_QHP = NO -QCH_FILE = -QHP_NAMESPACE = org.doxygen.Project -QHP_VIRTUAL_FOLDER = doc -QHP_CUST_FILTER_NAME = -QHP_CUST_FILTER_ATTRS = -QHP_SECT_FILTER_ATTRS = -QHG_LOCATION = -GENERATE_ECLIPSEHELP = NO -ECLIPSE_DOC_ID = org.doxygen.Project -DISABLE_INDEX = NO -GENERATE_TREEVIEW = NO -ENUM_VALUES_PER_LINE = 4 -TREEVIEW_WIDTH = 250 -EXT_LINKS_IN_WINDOW = NO -FORMULA_FONTSIZE = 10 -FORMULA_TRANSPARENT = YES -USE_MATHJAX = NO -MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest -MATHJAX_EXTENSIONS = -SEARCHENGINE = YES -SERVER_BASED_SEARCH = NO -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- -GENERATE_LATEX = NO -LATEX_OUTPUT = latex -LATEX_CMD_NAME = latex -MAKEINDEX_CMD_NAME = makeindex -COMPACT_LATEX = NO -PAPER_TYPE = a4 -EXTRA_PACKAGES = -LATEX_HEADER = -LATEX_FOOTER = -PDF_HYPERLINKS = YES -USE_PDFLATEX = YES -LATEX_BATCHMODE = NO -LATEX_HIDE_INDICES = NO -LATEX_SOURCE_CODE = NO -LATEX_BIB_STYLE = plain -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- -GENERATE_RTF = NO -RTF_OUTPUT = rtf -COMPACT_RTF = NO -RTF_HYPERLINKS = NO -RTF_STYLESHEET_FILE = -RTF_EXTENSIONS_FILE = -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- -GENERATE_MAN = NO -MAN_OUTPUT = man -MAN_EXTENSION = .3 -MAN_LINKS = NO -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- -GENERATE_XML = NO -XML_OUTPUT = xml -XML_SCHEMA = -XML_DTD = -XML_PROGRAMLISTING = YES -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- -GENERATE_AUTOGEN_DEF = NO -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- -GENERATE_PERLMOD = NO -PERLMOD_LATEX = NO -PERLMOD_PRETTY = YES -PERLMOD_MAKEVAR_PREFIX = -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- -ENABLE_PREPROCESSING = YES -MACRO_EXPANSION = NO -EXPAND_ONLY_PREDEF = NO -SEARCH_INCLUDES = YES -INCLUDE_PATH = -INCLUDE_FILE_PATTERNS = -PREDEFINED = -EXPAND_AS_DEFINED = -SKIP_FUNCTION_MACROS = YES -#--------------------------------------------------------------------------- -# Configuration::additions related to external references -#--------------------------------------------------------------------------- -TAGFILES = -GENERATE_TAGFILE = -ALLEXTERNALS = NO -EXTERNAL_GROUPS = YES -PERL_PATH = /usr/bin/perl -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- -CLASS_DIAGRAMS = YES -MSCGEN_PATH = -HIDE_UNDOC_RELATIONS = YES -HAVE_DOT = NO -DOT_NUM_THREADS = 0 -DOT_FONTNAME = Helvetica -DOT_FONTSIZE = 10 -DOT_FONTPATH = -CLASS_GRAPH = YES -COLLABORATION_GRAPH = YES -GROUP_GRAPHS = YES -UML_LOOK = NO -UML_LIMIT_NUM_FIELDS = 10 -TEMPLATE_RELATIONS = NO -INCLUDE_GRAPH = YES -INCLUDED_BY_GRAPH = YES -CALL_GRAPH = NO -CALLER_GRAPH = NO -GRAPHICAL_HIERARCHY = YES -DIRECTORY_GRAPH = YES -DOT_IMAGE_FORMAT = png -INTERACTIVE_SVG = NO -DOT_PATH = -DOTFILE_DIRS = -MSCFILE_DIRS = -DOT_GRAPH_MAX_NODES = 50 -MAX_DOT_GRAPH_DEPTH = 0 -DOT_TRANSPARENT = NO -DOT_MULTI_TARGETS = YES -GENERATE_LEGEND = YES -DOT_CLEANUP = YES diff --git a/plasma/applets/homerun/lib/HomerunConfig.cmake.in b/plasma/applets/homerun/lib/HomerunConfig.cmake.in deleted file mode 100644 index 4bb51d40..00000000 --- a/plasma/applets/homerun/lib/HomerunConfig.cmake.in +++ /dev/null @@ -1,17 +0,0 @@ -get_filename_component(HOMERUN_CMAKE_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) - -# versions -set(HOMERUN_VERSION_MAJOR @lib_VERSION_MAJOR@) -set(HOMERUN_VERSION_MINOR @lib_VERSION_MINOR@) -set(HOMERUN_VERSION_PATCH @lib_VERSION_PATCH@) -set(HOMERUN_VERSION @lib_VERSION@) -set(HOMERUN_VERSION_STRING "@lib_VERSION@") - -# includes -set(HOMERUN_INCLUDES "@INCLUDE_INSTALL_DIR@/homerun") - -# exported targets -include(${HOMERUN_CMAKE_DIR}/HomerunTargets.cmake) - -# libraries -set(HOMERUN_LIBRARIES homerun) diff --git a/plasma/applets/homerun/lib/abstractsource.cpp b/plasma/applets/homerun/lib/abstractsource.cpp deleted file mode 100644 index d8b77b01..00000000 --- a/plasma/applets/homerun/lib/abstractsource.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -// Self -#include - -// Local - -// KDE - -// Qt - -namespace Homerun { - -struct AbstractSourcePrivate -{ - KSharedConfig::Ptr m_config; -}; - -AbstractSource::AbstractSource(QObject *parent, const QVariantList &/*args*/) -: QObject(parent) -, d(new AbstractSourcePrivate) -{ -} - -AbstractSource::~AbstractSource() -{ - delete d; -} - -QAbstractItemModel *AbstractSource::createModelFromArguments(const QVariantMap &) -{ - return 0; -} - -bool AbstractSource::isConfigurable() const -{ - return false; -} - -SourceConfigurationWidget *AbstractSource::createConfigurationWidget(const KConfigGroup &) -{ - return 0; -} - -KSharedConfig::Ptr AbstractSource::config() const -{ - return d->m_config; -} - -void AbstractSource::setConfig(const KSharedConfig::Ptr& config) -{ - d->m_config = config; -} - -} // namespace Homerun - -#include "moc_abstractsource.cpp" diff --git a/plasma/applets/homerun/lib/abstractsource.h b/plasma/applets/homerun/lib/abstractsource.h deleted file mode 100644 index 19886024..00000000 --- a/plasma/applets/homerun/lib/abstractsource.h +++ /dev/null @@ -1,167 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -#ifndef ABSTRACTSOURCE_H -#define ABSTRACTSOURCE_H - -// Local -#include - -// Qt -#include -#include - -// KDE -#include - -class QAbstractItemModel; - -namespace Homerun { - -class SourceRegistry; -class SourceRegistryPrivate; - -class SourceConfigurationWidget; - -class AbstractSourcePrivate; - -/** - * Base class to implement Homerun sources - * - * The job of a source is to allow Homerun to instantiate models. - * The models are what show the items in Homerun tabs. - * - * You don't need to inherit from this class if you want to write a simple - * source, look at the SimpleSource class instead. - * - * A source can be configurable, to make it configurable, reimplement - * isConfigurable() to return true, and reimplement createConfigurationWidget() - * to return a SourceConfigurationWidget initialized from the source - * configuration. - * - * @see @ref homerunmodel - */ -class HOMERUN_EXPORT AbstractSource : public QObject -{ - Q_OBJECT -public: - AbstractSource(QObject *parent, const QVariantList &args = QVariantList()); - ~AbstractSource(); - - /** - * The main method. You must reimplement this method to create a model from - * a configuration group. - * - * @param group The configuration group to read from - * @return a Qt model, exposing Homerun roles and properties - */ - virtual QAbstractItemModel *createModelFromConfigGroup(const KConfigGroup &group) = 0; - - /** - * If you want your source to be usable from other sources using the - * openSourceRequested() signal, you must reimplement this method. - * It returns a null pointer by default. - * - * Note: it would have made more sense for args to be a QVariantHash as the - * order of the arguments does not matter. It is a QVariantMap because of - * a C++ -> QML -> C++ problem: When a QVariantHash is exposed to QML it is - * turned into a JavaScript Object, but when this Object is passed back to - * C++, it is turned into a QVariantMap, not a QVariantHash. - * - * @param args A map of named arguments - * @return a Qt model, exposing Homerun roles and properties - */ - virtual QAbstractItemModel *createModelFromArguments(const QVariantMap &args); - - /** - * Indicates whether this source is configurable. - * - * When configuring Homerun tabs, Homerun shows a configure button for - * configurable sources. When the configure button is clicked, Homerun calls - * createConfigurationWidget() and shows a dialog with the returned widget. - * - * Default implementation returns false. - * - * @return Whether this source is configurable or not - * - */ - virtual bool isConfigurable() const; - - /** - * Returns a widget to configure the source. See SourceConfigurationWidget - * for more details. - * - * isConfigurable() must have been reimplemented to return true for this - * method to be called. - * - * @param group The configuration group for this source - * @return A SourceConfigurationWidget ready to be shown by Homerun - */ - virtual SourceConfigurationWidget *createConfigurationWidget(const KConfigGroup &group); - - /** - * Returns a KSharedConfig for Homerun configuration. You most likely do not - * need this, configuration should usually be done through - * SourceConfigurationWidget. - * - * @return A KSharedConfig for Homerun configuration - */ - KSharedConfig::Ptr config() const; - -private: - AbstractSourcePrivate * const d; - - /** - * @internal - */ - void setConfig(const KSharedConfig::Ptr&); - - friend class SourceRegistry; - friend class SourceRegistryPrivate; -}; - -/** - * If your source just creates an argument-less model, you can use this simpler - * template class. - */ -template -class HOMERUN_EXPORT SimpleSource : public AbstractSource -{ -public: - SimpleSource(QObject *parent, const QVariantList &args = QVariantList()) - : AbstractSource(parent, args) - {} - - QAbstractItemModel *createModelFromConfigGroup(const KConfigGroup &/*group*/) - { - return new T; - } -}; - -} // namespace Homerun - -/** - * libName: the library name without the "homerun_source_" prefix - * className: the class name of the source - */ -#define HOMERUN_EXPORT_SOURCE(libName, className) \ - K_PLUGIN_FACTORY(factory, registerPlugin();) \ - K_EXPORT_PLUGIN(factory("homerun_source_" #libName)) - -#endif /* ABSTRACTSOURCE_H */ diff --git a/plasma/applets/homerun/lib/actionlist.cpp b/plasma/applets/homerun/lib/actionlist.cpp deleted file mode 100644 index adeb12c6..00000000 --- a/plasma/applets/homerun/lib/actionlist.cpp +++ /dev/null @@ -1,140 +0,0 @@ -/* -Copyright 2013 Aurélien Gâteau - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -// Self -#include - -// Local - -// KDE -#include -#include -#include -#include -#include -#include -#include - -// libkonq -#include - -// Qt -#include - -namespace Homerun -{ - -namespace ActionList -{ - -QVariantMap createActionItem(const QString &label, const QString &actionId, const QVariant &actionArg) -{ - QVariantMap map; - map["text"] = label; - map["actionId"] = actionId; - if (actionArg.isValid()) { - map["actionArgument"] = actionArg; - } - return map; -} - -QVariantMap createTitleActionItem(const QString &label) -{ - QVariantMap map; - map["text"] = label; - map["type"] = "title"; - return map; -} - -QVariantMap createSeparatorActionItem() -{ - QVariantMap map; - map["type"] = "separator"; - return map; -} - -static QVariantMap createEmptyTrashItem() -{ - QVariantMap map = createActionItem( - i18nc("@action:inmenu", "Empty Trash"), - "_homerun_fileItem_emptyTrash"); - map["icon"] = KIcon("trash-empty"); - - KConfig trashConfig("trashrc", KConfig::SimpleConfig); - const bool isEmpty = trashConfig.group("Status").readEntry("Empty", true); - map["enabled"] = !isEmpty; - return map; -} - -QVariantList createListForFileItem(const KFileItem &fileItem) -{ - QVariantList list; - if (fileItem.url() == KUrl("trash:/")) { - list << createEmptyTrashItem() << createSeparatorActionItem(); - } - KService::List services = KMimeTypeTrader::self()->query(fileItem.mimetype(), "Application"); - if (!services.isEmpty()) { - list << createTitleActionItem(i18n("Open with:")); - Q_FOREACH(const KService::Ptr service, services) { - const QString text = service->name().replace('&', "&&"); - QVariantMap item = createActionItem(text, "_homerun_fileItem_openWith", service->entryPath()); - QString iconName = service->icon(); - if (!iconName.isEmpty()) { - item["icon"] = KIcon(service->icon()); - } - list << item; - } - list << createSeparatorActionItem(); - } - list << createActionItem(i18n("Properties"), "_homerun_fileItem_properties"); - return list; -} - -bool handleFileItemAction(const KFileItem &fileItem, const QString &actionId, const QVariant &actionArg, bool *close) -{ - if (actionId == "_homerun_fileItem_properties") { - KPropertiesDialog *dlg = new KPropertiesDialog(fileItem, QApplication::activeWindow()); - dlg->setAttribute(Qt::WA_DeleteOnClose); - dlg->show(); - *close = false; - return true; - } - - if (actionId == "_homerun_fileItem_openWith") { - const QString path = actionArg.toString(); - const KService::Ptr service = KService::serviceByDesktopPath(path); - if (!service) { - kWarning() << "Invalid service"; - return false; - } - KRun::run(*service, KUrl::List() << fileItem.url(), QApplication::activeWindow()); - *close = true; - return true; - } - - if (actionId == "_homerun_fileItem_emptyTrash") { - KonqOperations::emptyTrash(QApplication::activeWindow()); - return true; - } - - return false; -} - -} // namespace ActionList -} // namespace Homerun diff --git a/plasma/applets/homerun/lib/actionlist.h b/plasma/applets/homerun/lib/actionlist.h deleted file mode 100644 index 0c4184fa..00000000 --- a/plasma/applets/homerun/lib/actionlist.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -Copyright 2013 Aurélien Gâteau - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -#ifndef ACTIONLIST_H -#define ACTIONLIST_H - -// Local -#include - -// Qt -#include - -// KDE - -class KFileItem; - -namespace Homerun -{ - -/** - * Helper functions to create action list items - */ -namespace ActionList -{ - -QVariantMap HOMERUN_EXPORT createActionItem(const QString &label, const QString &actionId, const QVariant &actionArg = QVariant()); - -QVariantMap HOMERUN_EXPORT createTitleActionItem(const QString &label); - -QVariantMap HOMERUN_EXPORT createSeparatorActionItem(); - -QVariantList HOMERUN_EXPORT createListForFileItem(const KFileItem &fileItem); - -/** - * Handle action if it has been created by this namespace - * @param fileItem The file item for which the action was created - * @param actionId The action id - * @param actionArg The action argument - * @param close Set to true if homerun should close. Only makes sense if the action has been handled. Cannot be NULL. - * @return true if the action has been handled - */ -bool HOMERUN_EXPORT handleFileItemAction(const KFileItem &fileItem, const QString &actionId, const QVariant &actionArg, bool *close); - -} // namespace ActionList -} // namespace Homerun - -#endif /* ACTIONLIST_H */ diff --git a/plasma/applets/homerun/lib/homerun-source.desktop b/plasma/applets/homerun/lib/homerun-source.desktop deleted file mode 100644 index e6f3e793..00000000 --- a/plasma/applets/homerun/lib/homerun-source.desktop +++ /dev/null @@ -1,37 +0,0 @@ -[Desktop Entry] -Type=ServiceType -X-KDE-ServiceType=Homerun/Source -Comment=Homerun source plugin -Comment[bs]=Homerun izvorišni priključak -Comment[ca]=Connector de fonts per a Homerun -Comment[ca@valencia]=Connector de fonts per a Homerun -Comment[da]=Kildeplugin til Homerun -Comment[de]=Quellmodul für Homerun -Comment[el]=Πρόσθετη πηγή Homerun -Comment[es]=Complemento de origen para Homerun -Comment[et]=Homeruni allikaplugin -Comment[fi]=Homerunin lähdeliitännäinen -Comment[fr]=Module externe Homerun -Comment[gl]=Engadido de fontes de Homerun -Comment[hu]=Homerun forrás bővítmény -Comment[it]=Estensione delle fonti di Homerun -Comment[ko]=Homerun 원본 코드 플러그인 -Comment[lt]=Homerun šaltinio priedas -Comment[mr]=होमरन स्रोत प्लगइन -Comment[nl]=Plug-in voor Homerun-bron -Comment[pa]=ਹੋਮਰਨ ਸਰੋਤ ਪਲੱਗਇਨ -Comment[pl]=Wtyczka źródła Homerun -Comment[pt]='Plugin' de código do Homerun -Comment[pt_BR]=Plugin de código do Homerun -Comment[ro]=Extensie de sursă Homerun -Comment[ru]=Модуль источника Homerun -Comment[sk]=Plugin zdroja Homerun -Comment[sl]=Vstavek za izvorno kodo za Homerun -Comment[sv]=Homerun-källinsticksprogram -Comment[tr]=Homerun kaynak eklentisi -Comment[uk]=Додаток джерела до Homerun -Comment[x-test]=xxHomerun source pluginxx -Comment[zh_CN]=Homerun 源插件 - -[PropertyDef::X-KDE-Homerun-APIVersion] -Type=int diff --git a/plasma/applets/homerun/lib/homerun_export.h b/plasma/applets/homerun/lib/homerun_export.h deleted file mode 100644 index 0d601062..00000000 --- a/plasma/applets/homerun/lib/homerun_export.h +++ /dev/null @@ -1,35 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -#ifndef HOMERUN_EXPORT_H -#define HOMERUN_EXPORT_H - -#include - -#ifndef HOMERUN_EXPORT -# if defined(MAKE_HOMERUN_LIB) -/* We are building this library */ -# define HOMERUN_EXPORT KDE_EXPORT -# else -/* We are using this library */ -# define HOMERUN_EXPORT KDE_IMPORT -# endif -#endif - -#endif /* HOMERUN_EXPORT_H */ diff --git a/plasma/applets/homerun/lib/homerunmodel.md b/plasma/applets/homerun/lib/homerunmodel.md deleted file mode 100644 index e85992e0..00000000 --- a/plasma/applets/homerun/lib/homerunmodel.md +++ /dev/null @@ -1,160 +0,0 @@ -Homerun Model Specification {#homerunmodel} -=========================== - -Homerun models make heavy use of Qt introspection and duck-typing. This -document describes the mandatory and optional roles, properties and signals of a -Homerun model. - -## Mandatory elements - -### Roles -#### string display - -The item text. - -#### string|QIcon decoration - -The item icon, as a string or as a QIcon. - -### Properties -#### string name -- access: read-only - -Returns a translated name for the model. This name is used as a title for the -view associated with the model. - -#### int count -- access: read-only - -Returns current number of rows. Most often it will simply return -rowCount(QModelIndex()). - -### Methods -#### bool trigger(int row, string actionId = "", QVariant actionArgument = QVariant()) - -Triggers the action identified by `actionId` on the item at row `row`. -`actionId` and `actionArgument` are defined in the `actionList` role. - -Returns true if you want Homerun to close, false otherwise. - -Note: When the user clicks on an item, `actionId` is an empty string. - - - - -## To create items which can be favorited - -### Roles -#### string favoriteId - -Unique Id used to favorite this item. Its value depends on the item type: - -- item cannot be favorited: "" -- item is an application: "app:" + $desktopName. - Examples: "app:inkscape.desktop" or "app:kde4-dolphin.desktop" for KDE applications. -- item is a place: "place:" + $url. - Examples: "place:file:///home/jdoe/Documents" or "place:sftp://host.com/dir". - - - - -## To create items with actions - -### Roles -#### bool hasActionList - -Set to true if the item has additional actions, defined by the actionList -role. - -#### QVariantList actionList - -A list of QVariantMap describing extra actions. Each map should contain the -following elements: - -- string type - - mandatory: no, default to "action" - - Can be one of "action", "title" or "separator" -- string text - - mandatory: yes - - The visible text shown in the item context menu -- QIcon icon - - mandatory: no - - The icon associated with the action -- string actionId - - mandatory: yes - - An id passed to trigger() to distinguish between actions -- variant actionArgument - - mandatory: no - - An optional argument, passed to trigger() as well -- bool enabled - - mandatory: no - - If set to true or omitted, the item will be enabled. If set to false, it will be disabled - -Functions from the Homerun::ActionList namespace simplify the creation of -actions. - -Important: This role is ignored if hasActionList is not defined or returns -false. - - - - -## To create browsable models - -### Properties -#### Homerun::PathModel pathModel -- access: read-only - -This property must return a Homerun::PathModel instance representing the -position inside the model. - -### Signals -#### openSourceRequested(QString sourceId, const QVariantMap &arguments) - -Emitted by a model when it wants another source to be opened by the view. This -is used for example to open a browsable model in a subdir. - -Note: If you want to be able to access your model this way, you need to -implement Homerun::AbstractSource::createModelFromArguments(). - - - - -## To give running feedback - -### Properties -#### bool running -- access: read-only - -Set to true to indicate the model is busy filling itself. Homerun will show a -busy indicator as long as this property is true. - - - - -## To provide custom searching/filtering - -### Properties -#### string query -- access: read-write - -A model can implement this property to implement searching/filtering itself. If -it is not defined, Homerun will apply a generic filter to the item names when -the user type a search criteria. - - - - -## To let the user reorder items - -### Properties -#### bool canMoveRow -- access: read-only - -Implement this property and make it return true. - -### Methods -#### void moveRow(int from, int to) - -This method should move row `from` to row `to` in the model and take care of -any necessary serialization. diff --git a/plasma/applets/homerun/lib/libhomerun_config.h.in b/plasma/applets/homerun/lib/libhomerun_config.h.in deleted file mode 100644 index fd4372ec..00000000 --- a/plasma/applets/homerun/lib/libhomerun_config.h.in +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2012 Aurélien Gâteau - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -#ifndef LIBHOMERUN_CONFIG_H -#define LIBHOMERUN_CONFIG_H - -#define HOMERUN_API_VERSION @lib_VERSION_MAJOR@ - -#endif /* LIBHOMERUN_CONFIG_H */ diff --git a/plasma/applets/homerun/lib/mainpage.md b/plasma/applets/homerun/lib/mainpage.md deleted file mode 100644 index d1ba1e0a..00000000 --- a/plasma/applets/homerun/lib/mainpage.md +++ /dev/null @@ -1,8 +0,0 @@ -libhomerun documentation {#mainpage} -======================== - -libhomerun makes it possible for you to build sources for Homerun. - -To do so, you need to: -- Create a source inheriting from Homerun::AbstractSource (or use Homerun::SimpleSource) -- Have your source provide a model following the [Homerun model specification](@ref homerunmodel). diff --git a/plasma/applets/homerun/lib/pathmodel.cpp b/plasma/applets/homerun/lib/pathmodel.cpp deleted file mode 100644 index 5693cdb3..00000000 --- a/plasma/applets/homerun/lib/pathmodel.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -// Self -#include - -// Local - -// KDE - -// Qt - -namespace Homerun { - -enum { - SourceIdRole = Qt::UserRole + 1, - SourceArgumentsRole -}; - -struct PathModelPrivate -{ -}; - -PathModel::PathModel(QObject *parent) -: QStandardItemModel(parent) -, d(new PathModelPrivate) -{ - QHash roles; - roles.insert(Qt::DisplayRole, "display"); - roles.insert(SourceIdRole, "sourceId"); - roles.insert(SourceArgumentsRole, "sourceArguments"); - setRoleNames(roles); - connect(this, SIGNAL(modelReset()), SIGNAL(countChanged())); - connect(this, SIGNAL(rowsInserted(QModelIndex, int, int)), SIGNAL(countChanged())); - connect(this, SIGNAL(rowsRemoved(QModelIndex, int, int)), SIGNAL(countChanged())); -} - -PathModel::~PathModel() -{ - delete d; -} - -void PathModel::addPath(const QString &label, const QString &sourceId, const QVariantMap &sourceArguments) -{ - QStandardItem *item = new QStandardItem(label); - item->setData(sourceId, SourceIdRole); - item->setData(sourceArguments, SourceArgumentsRole); - appendRow(item); -} - -int PathModel::count() const -{ - return rowCount(); -} - -QVariantHash PathModel::get(int row) const -{ - QStandardItem *itm = item(row); - Q_ASSERT(itm); - QVariantHash hash; - hash["display"] = itm->text(); - hash["sourceId"] = itm->data(SourceIdRole).toString(); - hash["sourceArguments"] = itm->data(SourceArgumentsRole).toMap(); - return hash; -} - -} // namespace Homerun - -#include "moc_pathmodel.cpp" diff --git a/plasma/applets/homerun/lib/pathmodel.h b/plasma/applets/homerun/lib/pathmodel.h deleted file mode 100644 index 80e5c04b..00000000 --- a/plasma/applets/homerun/lib/pathmodel.h +++ /dev/null @@ -1,61 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -#ifndef PATHMODEL_H -#define PATHMODEL_H - -// Local -#include - -// Qt -#include - -// KDE - -namespace Homerun { - -class PathModelPrivate; - -/** - * Represents the path in a browsable Homerun model - */ -class HOMERUN_EXPORT PathModel : public QStandardItemModel -{ - Q_OBJECT - Q_PROPERTY(int count READ count NOTIFY countChanged) -public: - explicit PathModel(QObject *parent = 0); - ~PathModel(); - - void addPath(const QString &label, const QString &sourceId, const QVariantMap &sourceArguments); - - int count() const; - - Q_INVOKABLE QVariantHash get(int row) const; - -Q_SIGNALS: - void countChanged(); - -private: - PathModelPrivate * const d; -}; - -} // namespace Homerun - -#endif /* PATHMODEL_H */ diff --git a/plasma/applets/homerun/lib/sourceconfigurationwidget.cpp b/plasma/applets/homerun/lib/sourceconfigurationwidget.cpp deleted file mode 100644 index 00661e3d..00000000 --- a/plasma/applets/homerun/lib/sourceconfigurationwidget.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -// Self -#include - -// Local - -// KDE -#include - -// Qt - -namespace Homerun -{ - -struct SourceConfigurationWidgetPrivate -{ - SourceConfigurationWidgetPrivate(const KConfigGroup &group) - : m_group(group) - {} - - KConfigGroup m_group; -}; - -SourceConfigurationWidget::SourceConfigurationWidget(const KConfigGroup &group, QWidget *parent) -: QWidget(parent) -, d(new SourceConfigurationWidgetPrivate(group)) -{ -} - -SourceConfigurationWidget::~SourceConfigurationWidget() -{ - delete d; -} - -KConfigGroup SourceConfigurationWidget::configGroup() const -{ - return d->m_group; -} - -} // namespace - -#include "moc_sourceconfigurationwidget.cpp" diff --git a/plasma/applets/homerun/lib/sourceconfigurationwidget.h b/plasma/applets/homerun/lib/sourceconfigurationwidget.h deleted file mode 100644 index a0f37464..00000000 --- a/plasma/applets/homerun/lib/sourceconfigurationwidget.h +++ /dev/null @@ -1,73 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) version 3, or any -later version accepted by the membership of KDE e.V. (or its -successor approved by the membership of KDE e.V.), which shall -act as a proxy defined in Section 6 of version 3 of the license. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library. If not, see . -*/ -#ifndef SOURCECONFIGURATIONWIDGET_H -#define SOURCECONFIGURATIONWIDGET_H - -// Local -#include - -// Qt -#include - -// KDE - -class KConfigGroup; - -namespace Homerun -{ - -struct SourceConfigurationWidgetPrivate; - -/** - * Used by configurable sources to provide a configuration widget. - */ -class HOMERUN_EXPORT SourceConfigurationWidget : public QWidget -{ - Q_OBJECT -public: - /** - * Creates a configuration widget, initialized to show the configuration - * from group - * - * @param group KConfigGroup to read configuration from - * @param parent QWidget which will be the parent of this widget - */ - SourceConfigurationWidget(const KConfigGroup &group, QWidget *parent = 0); - ~SourceConfigurationWidget(); - - /** - * This method must save configuration changes to configGroup(). - * Homerun takes care of calling KConfig::sync() to ensure changes are - * stored to disk. - */ - virtual void save() = 0; - - /** - * Returns the config group which was passed to the constructor. - */ - KConfigGroup configGroup() const; - -private: - SourceConfigurationWidgetPrivate *const d; -}; - -} // namespace - -#endif /* SOURCECONFIGURATIONWIDGET_H */ diff --git a/plasma/applets/homerun/plugins/CMakeLists.txt b/plasma/applets/homerun/plugins/CMakeLists.txt deleted file mode 100644 index de89da12..00000000 --- a/plasma/applets/homerun/plugins/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_subdirectory(recentdocuments) diff --git a/plasma/applets/homerun/plugins/recentdocuments/CMakeLists.txt b/plasma/applets/homerun/plugins/recentdocuments/CMakeLists.txt deleted file mode 100644 index ebb5a5ad..00000000 --- a/plasma/applets/homerun/plugins/recentdocuments/CMakeLists.txt +++ /dev/null @@ -1,29 +0,0 @@ -project(recentdocuments) - -# Source -set(recentdocuments_SRCS - recentdocuments.cpp -) - -# Build -kde4_add_plugin(homerun_source_recentdocuments SHARED ${recentdocuments_SRCS}) - -include_directories( - ${lib_SOURCE_DIR} - ${KDE4_INCLUDES} -) - -# The library name must start with "homerun_source_". The -# HOMERUN_EXPORT_SOURCE C macro expects this. -target_link_libraries(homerun_source_recentdocuments - ${QT_QTCORE_LIBRARY} - ${QT_QTGUI_LIBRARY} - ${QT_QTDECLARATIVE_LIBRARY} - ${KDE4_KDECORE_LIBS} - ${KDE4_KFILE_LIBS} - homerun -) - -# Install -install(TARGETS homerun_source_recentdocuments DESTINATION ${PLUGIN_INSTALL_DIR}) -install(FILES homerun-source-recentdocuments.desktop DESTINATION ${SERVICES_INSTALL_DIR}) diff --git a/plasma/applets/homerun/plugins/recentdocuments/homerun-source-recentdocuments.desktop b/plasma/applets/homerun/plugins/recentdocuments/homerun-source-recentdocuments.desktop deleted file mode 100644 index 6b24b28a..00000000 --- a/plasma/applets/homerun/plugins/recentdocuments/homerun-source-recentdocuments.desktop +++ /dev/null @@ -1,74 +0,0 @@ -[Desktop Entry] -Name=Recent Documents -Name[bs]=nedavnii dokumenti -Name[ca]=Documents recents -Name[ca@valencia]=Documents recents -Name[cs]=Nedávné dokumenty -Name[da]=Nylige dokumenter -Name[de]=Zuletzt geöffnete Dokumente -Name[el]=Πρόσφατα έγγραφα -Name[es]=Documentos recientes -Name[et]=Viimati kasutatud dokumendid -Name[fi]=Viimeisimmät tiedostot -Name[fr]=Documents récents -Name[ga]=Cáipéisí is Déanaí -Name[gl]=Documentos recentes -Name[hu]=Legutóbbi dokumentumok -Name[it]=Documenti recenti -Name[ko]=최근 문서 -Name[lt]=Neseniai naudoti dokumentai -Name[mr]=अलिकडील दस्तऐवज -Name[nl]=Recente documenten -Name[pa]=ਤਾਜ਼ਾ ਡੌਕੂਮੈਂਟ -Name[pl]=Ostatnie dokumenty -Name[pt]=Documentos Recentes -Name[pt_BR]=Documentos recentes -Name[ro]=Documente recente -Name[ru]=Последние документы -Name[sk]=Nedávne dokumenty -Name[sl]=Nedavni dokumenti -Name[sv]=Senaste dokument -Name[tr]=Son Kullanılan Belgeler -Name[ug]=يېقىنقى پۈتۈكلەر -Name[uk]=Нещодавні документи -Name[x-test]=xxRecent Documentsxx -Name[zh_CN]=最近的文档 -Comment=List recently opened documents -Comment[bs]=Lista nedavno otvaranih dokumenata -Comment[ca]=Llista dels documents oberts recentment -Comment[ca@valencia]=Llista dels documents oberts recentment -Comment[cs]=Seznam nedávno otevřených dokumentů -Comment[da]=Liste over nyligt åbnede dokumenter -Comment[de]=Zeigt die zuletzt geöffneten Dokumente an -Comment[el]=Εμφανίζει τα πρόσφατα ανοιγμένα έγγραφα -Comment[es]=Lista los documentos abiertos recientemente -Comment[et]=Viimati avatud dokumentide nimekiri -Comment[fi]=Viimeksi avattujen tiedostojen luettelo -Comment[fr]=Liste les documents récemment ouverts -Comment[gl]=Lista de documentos abertos recentemente -Comment[hu]=Legutóbb megnyitott dokumentumok listázása -Comment[it]=Elenca i documenti aperti di recente -Comment[ko]=최근 사용된 문서 목록 -Comment[lt]=Parodyti neseniai naudotus dokumentus -Comment[mr]=अलिकडे उघडलेल्या दस्तऐवजांची यादी -Comment[nl]=Recent geopende documenten tonen -Comment[pa]=ਤਾਜ਼ਾ ਖੁੱਲ੍ਹੇ ਗਏ ਡੌਕੂਮੈਂਟ ਦੀ ਸੂਚੀ -Comment[pl]=Lista ostatnio otwieranych dokumentów -Comment[pt]=Listar os documentos abertos recentemente -Comment[pt_BR]=Lista dos documentos abertos recentemente -Comment[ro]=Lista documentelor deschise recent -Comment[ru]=Список последних открытых документов -Comment[sk]=Vypísať nedávno otvorené dokumenty -Comment[sl]=Prikaži seznam zadnje odprtih dokumentov -Comment[sv]=Lista senast öppnade dokument -Comment[tr]=En son açılan belgeleri listele -Comment[uk]=Список нещодавно відкритих документів -Comment[x-test]=xxList recently opened documentsxx -Comment[zh_CN]=列出最近打开的文档 -Type=Service -X-KDE-ServiceTypes=Homerun/Source -X-KDE-Library=homerun_source_recentdocuments - -X-KDE-PluginInfo-Name=RecentDocuments - -X-KDE-Homerun-APIVersion=0 diff --git a/plasma/applets/homerun/plugins/recentdocuments/recentdocuments.cpp b/plasma/applets/homerun/plugins/recentdocuments/recentdocuments.cpp deleted file mode 100644 index 1107adc9..00000000 --- a/plasma/applets/homerun/plugins/recentdocuments/recentdocuments.cpp +++ /dev/null @@ -1,158 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 2 of -the License or (at your option) version 3 or any later version -accepted by the membership of KDE e.V. (or its successor approved -by the membership of KDE e.V.), which shall act as a proxy -defined in Section 14 of version 3 of the license. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ -// Self -#include - -// Homerun -#include -#include - -// KDE -#include -#include -#include -#include -#include -#include -#include -#include - -// Qt -#include - -typedef Homerun::SimpleSource RecentDocumentsSource; -HOMERUN_EXPORT_SOURCE(recentdocuments, RecentDocumentsSource) - -RecentDocumentsModel::RecentDocumentsModel() -{ - QHash roles; - roles.insert(Qt::DisplayRole, "display"); - roles.insert(Qt::DecorationRole, "decoration"); - roles.insert(HasActionListRole, "hasActionList"); - roles.insert(ActionListRole, "actionList"); - setRoleNames(roles); - - KDirWatch *watch = new KDirWatch(this); - watch->addDir(KRecentDocument::recentDocumentDirectory()); - - connect(watch, SIGNAL(created(QString)), SLOT(load())); - connect(watch, SIGNAL(deleted(QString)), SLOT(load())); - connect(watch, SIGNAL(dirty(QString)), SLOT(load())); - load(); -} - -void RecentDocumentsModel::load() -{ - clear(); - QSet urls; - Q_FOREACH(const QString &path, KRecentDocument::recentDocuments()) { - KDesktopFile file(path); - QString url = file.readUrl(); - - // Prevent duplicate entries - if (urls.contains(url)) { - continue; - } - - QString name = file.readName(); - if (name.isEmpty()) { - name = url; - } - if (name.isEmpty()) { - kWarning() << "Skipping" << path << ": it has no name or url."; - continue; - } - QStandardItem *item = new QStandardItem(name); - item->setData(file.readIcon(), Qt::DecorationRole); - item->setData(path, DesktopPathRole); - item->setData(url, UrlRole); - item->setData(true, HasActionListRole); - appendRow(item); - - urls.insert(url); - } - countChanged(); -} - -bool RecentDocumentsModel::trigger(int row, const QString &actionId, const QVariant &actionArgument) -{ - QStandardItem *itm = item(row); - Q_ASSERT(itm); - KUrl url = itm->data(UrlRole).toString(); - if (actionId.isEmpty()) { - new KRun(url, 0); - return true; - } - if (actionId == "forget") { - forget(itm); - return false; - } - bool close = false; - KFileItem item(KFileItem::Unknown, KFileItem::Unknown, url); - if (Homerun::ActionList::handleFileItemAction(item, actionId, actionArgument, &close)) { - return close; - } - return false; -} - -void RecentDocumentsModel::forget(QStandardItem *itm) -{ - Q_ASSERT(itm); - QString path = itm->data(DesktopPathRole).toString(); - - bool ok = QFile::remove(path); - if (!ok) { - kWarning() << "Failed to remove" << path; - return; - } - delete itm; -} - -QString RecentDocumentsModel::name() const -{ - return i18n("Recent Documents"); -} - -int RecentDocumentsModel::count() const -{ - return rowCount(QModelIndex()); -} - -QVariant RecentDocumentsModel::data(const QModelIndex& index, int role) const -{ - if (role != ActionListRole) { - return QStandardItemModel::data(index, role); - } - QStandardItem *itm = itemFromIndex(index); - if (!itm) { - return QVariant(); - } - KUrl url = itm->data(UrlRole).toString(); - KFileItem item(KFileItem::Unknown, KFileItem::Unknown, url); - QVariantList actionList = Homerun::ActionList::createListForFileItem(item); - - actionList.prepend(Homerun::ActionList::createSeparatorActionItem()); - QVariantMap forgetAction = Homerun::ActionList::createActionItem(i18n("Forget Document"), "forget"); - actionList.prepend(forgetAction); - - return actionList; -} - -#include "moc_recentdocuments.cpp" diff --git a/plasma/applets/homerun/plugins/recentdocuments/recentdocuments.h b/plasma/applets/homerun/plugins/recentdocuments/recentdocuments.h deleted file mode 100644 index f9e9a59f..00000000 --- a/plasma/applets/homerun/plugins/recentdocuments/recentdocuments.h +++ /dev/null @@ -1,62 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 2 of -the License or (at your option) version 3 or any later version -accepted by the membership of KDE e.V. (or its successor approved -by the membership of KDE e.V.), which shall act as a proxy -defined in Section 14 of version 3 of the license. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ -#ifndef RECENTDOCUMENTS_H -#define RECENTDOCUMENTS_H - -// KDE -#include - -/** - * This model exposes recent documents handled by the RecentDocument class - */ -class RecentDocumentsModel : public QStandardItemModel -{ - Q_OBJECT - Q_PROPERTY(QString name READ name CONSTANT) - Q_PROPERTY(int count READ count NOTIFY countChanged) -public: - RecentDocumentsModel(); - - enum { - UrlRole = Qt::UserRole + 1, - DesktopPathRole, - HasActionListRole, - ActionListRole, - }; - - Q_INVOKABLE bool trigger(int row, const QString &actionId, const QVariant &actionArgument); - - QString name() const; - - int count() const; - - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; - -Q_SIGNALS: - void countChanged(); - -private Q_SLOTS: - void load(); - -private: - void forget(QStandardItem *item); -}; - -#endif /* RECENTDOCUMENTS_H */ diff --git a/plasma/applets/homerun/tests/CMakeLists.txt b/plasma/applets/homerun/tests/CMakeLists.txt deleted file mode 100644 index 06538271..00000000 --- a/plasma/applets/homerun/tests/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_subdirectory(auto) diff --git a/plasma/applets/homerun/tests/auto/CMakeLists.txt b/plasma/applets/homerun/tests/auto/CMakeLists.txt deleted file mode 100644 index c8f6d754..00000000 --- a/plasma/applets/homerun/tests/auto/CMakeLists.txt +++ /dev/null @@ -1,90 +0,0 @@ -macro(homerun_add_unit_test _test) - string(REGEX REPLACE "_x11$" "" _cpp "${_test}") # ${cpp} is ${_test} without the "_x11" prefix, if present - - # Put all .ui files in _ui, put the rest in _src - set(_src ${_cpp}.cpp) - set(_ui "") - foreach(_name ${ARGN}) - set(_src ${_src} ${_name}) - endforeach() - - kde4_add_test(homerun-${_test} ${_src}) - target_link_libraries(homerun-${_test} - ${KDE4_PLASMA_LIBS} - ${KDE4_KFILE_LIBS} - ${KDE4_KIO_LIBS} - ${KDE4_KDEUI_LIBS} - ${KDE4_KDECORE_LIBS} - ${KDE4_SOLID_LIBS} - ${QT_QTTEST_LIBRARY} - ${QT_QTCORE_LIBRARY} - ${QT_QTGUI_LIBRARY} - ${LIBKONQ_LIBRARY} - ) -endmacro(homerun_add_unit_test) - -include_directories( - ${components_SOURCE_DIR} - ${components_SOURCE_DIR}/sources/favorites - ${components_SOURCE_DIR}/sources/dir - ${CMAKE_SOURCE_DIR}/internal - ${lib_SOURCE_DIR} - ${lib_BINARY_DIR} - ${LIBKONQ_INCLUDE_DIR} - ) - -# Tests which depend on X11 cannot be run on headless builders. If X11 is not -# running, "make check" will not run X11-dependent tests. -# For "make check" to distinguish X11-dependent tests from X11-independent -# tests, binaries of X11-dependent tests must be suffixed with "_x11". - -# X11-independent tests -homerun_add_unit_test(tabmodeltest - ${components_SOURCE_DIR}/tabmodel.cpp - ${components_SOURCE_DIR}/sourcemodel.cpp - ${components_SOURCE_DIR}/abstractsourceregistry.cpp - ) - -homerun_add_unit_test(sourcemodeltest - ${components_SOURCE_DIR}/sourcemodel.cpp - ${components_SOURCE_DIR}/abstractsourceregistry.cpp - ) - -homerun_add_unit_test(i18nconfigtest) - -# X11-dependent tests -homerun_add_unit_test(favoriteappsmodeltest_x11 - ${components_SOURCE_DIR}/sources/favorites/favoriteappsmodel.cpp - ) - -homerun_add_unit_test(favoriteplacesmodeltest_x11 - ${components_SOURCE_DIR}/sources/dir/dirconfigurationwidget.cpp - ${components_SOURCE_DIR}/sources/dir/dirconfigurationwidget.ui - ${components_SOURCE_DIR}/sources/dir/dirmodel.cpp - ${components_SOURCE_DIR}/sources/favorites/favoriteplacesmodel.cpp - ${components_SOURCE_DIR}/sources/favorites/favoriteutils.cpp - ${components_SOURCE_DIR}/sources/favorites/fileplacesmodel.cpp - ${components_SOURCE_DIR}/sources/favorites/kfileplacesitem.cpp - ${components_SOURCE_DIR}/sources/favorites/kfileplacessharedbookmarks.cpp - ${lib_SOURCE_DIR}/abstractsource.cpp - ${lib_SOURCE_DIR}/actionlist.cpp - ${lib_SOURCE_DIR}/pathmodel.cpp - ${lib_SOURCE_DIR}/sourceconfigurationwidget.cpp - ) -homerun_add_unit_test(dirmodeltest_x11 - ${components_SOURCE_DIR}/sources/dir/dirconfigurationwidget.cpp - ${components_SOURCE_DIR}/sources/dir/dirconfigurationwidget.ui - ${components_SOURCE_DIR}/sources/dir/dirmodel.cpp - ${components_SOURCE_DIR}/sources/favorites/favoriteutils.cpp - ${lib_SOURCE_DIR}/abstractsource.cpp - ${lib_SOURCE_DIR}/actionlist.cpp - ${lib_SOURCE_DIR}/pathmodel.cpp - ${lib_SOURCE_DIR}/sourceconfigurationwidget.cpp - ) - -# Definition of the "check" target -set(_check_command ${CMAKE_CTEST_COMMAND} --verbose) -add_custom_target(check COMMAND - if [ -n \"$$DISPLAY\" ] \; then ${_check_command} \; else ${_check_command} --exclude-regex '_x11' \; fi - ) -add_dependencies(check buildtests) diff --git a/plasma/applets/homerun/tests/auto/dirmodeltest.cpp b/plasma/applets/homerun/tests/auto/dirmodeltest.cpp deleted file mode 100644 index ceb8ff41..00000000 --- a/plasma/applets/homerun/tests/auto/dirmodeltest.cpp +++ /dev/null @@ -1,149 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 2 of -the License or (at your option) version 3 or any later version -accepted by the membership of KDE e.V. (or its successor approved -by the membership of KDE e.V.), which shall act as a proxy -defined in Section 14 of version 3 of the license. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ -#include "dirmodeltest.h" - -// Local -#include - -// Qt -#include -#include -#include - -// KDE -#include -#include -#include -#include -#include -#include - -using namespace Homerun; - -QTEST_KDEMAIN(DirModelTest, GUI) - -static void touch(const QString &path) -{ - QFile file(path); - file.open(QIODevice::WriteOnly); -} - -void DirModelTest::initTestCase() -{ - QString dir = KGlobal::dirs()->localxdgdatadir(); - QFile file(dir + "/user-places.xbel"); - file.remove(); -} - -void DirModelTest::testDirModelSortOrder() -{ - KTempDir tempDir("dirmodeltest"); - QDir dir(tempDir.name()); - QStringList dirNames = QStringList() << "aaa" << "Abc" << "Hello"; - QStringList fileNames = QStringList() << "foo" << "Goo" << "hoo" << "img1" << "img2" << "img10"; - - Q_FOREACH(const QString &name, fileNames) { - touch(dir.absoluteFilePath(name)); - } - Q_FOREACH(const QString &name, dirNames) { - dir.mkdir(name); - } - - DirModel dirModel; - - QEventLoop loop; - connect(dirModel.dirLister(), SIGNAL(completed()), &loop, SLOT(quit())); - - KUrl rootUrl = KUrl::fromLocalFile(dir.absolutePath()); - dirModel.init(rootUrl, rootUrl.fileName(), rootUrl); - loop.exec(); - - QStringList expected = dirNames + fileNames; - for (int row = 0; row < dirModel.rowCount(); ++row) { - QModelIndex index = dirModel.index(row, 0); - QString name = index.data(Qt::DisplayRole).toString(); - QCOMPARE(name, expected[row]); - } -} - -void DirModelTest::testDirModelFavoriteId() -{ - KTempDir tempDir("dirmodeltest"); - QDir dir(tempDir.name()); - dir.mkdir("adir"); - touch(dir.absoluteFilePath("afile")); - - DirModel dirModel; - QEventLoop loop; - connect(dirModel.dirLister(), SIGNAL(completed()), &loop, SLOT(quit())); - - KUrl rootUrl = KUrl::fromLocalFile(dir.absolutePath()); - dirModel.init(rootUrl, rootUrl.fileName(), rootUrl); - loop.exec(); - - // Dir - { - QModelIndex index = dirModel.index(0, 0); - QString favoriteId = index.data(DirModel::FavoriteIdRole).toString(); - QCOMPARE(favoriteId, QString("place:file://" + dir.absoluteFilePath("adir"))); - } - // File - { - QModelIndex index = dirModel.index(1, 0); - QString favoriteId = index.data(DirModel::FavoriteIdRole).toString(); - QCOMPARE(favoriteId, QString()); - } -} - -void DirModelTest::testSortOrder() -{ - // Create sandbox - KTempDir tempDir("dirmodeltest"); - QDir dir(tempDir.name()); - QStringList dirNames = QStringList() << "aaa" << "Abc" << "Hello"; - QStringList fileNames = QStringList() << "foo" << "Goo" << "hoo" << "img1" << "img2" << "img10"; - - Q_FOREACH(const QString &name, fileNames) { - touch(dir.absoluteFilePath(name)); - } - Q_FOREACH(const QString &name, dirNames) { - dir.mkdir(name); - } - - // Point a DirModel to the sandbox - DirModel dirModel; - QEventLoop loop; - connect(dirModel.dirLister(), SIGNAL(completed()), &loop, SLOT(quit())); - - KUrl rootUrl = KUrl::fromLocalFile(dir.absolutePath()); - dirModel.init(rootUrl, rootUrl.fileName(), rootUrl); - loop.exec(); - - // Check model content - QStringList expected = dirNames + fileNames; - QCOMPARE(dirModel.rowCount(), expected.length()); - for (int row = 0; row < dirModel.rowCount(); ++row) { - QModelIndex index = dirModel.index(row, 0); - QString name = index.data(Qt::DisplayRole).toString(); - QCOMPARE(name, expected[row]); - } -} - -#include "moc_dirmodeltest.cpp" diff --git a/plasma/applets/homerun/tests/auto/dirmodeltest.h b/plasma/applets/homerun/tests/auto/dirmodeltest.h deleted file mode 100644 index 65312394..00000000 --- a/plasma/applets/homerun/tests/auto/dirmodeltest.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 2 of -the License or (at your option) version 3 or any later version -accepted by the membership of KDE e.V. (or its successor approved -by the membership of KDE e.V.), which shall act as a proxy -defined in Section 14 of version 3 of the license. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ -#ifndef DIRMODELTEST_H -#define DIRMODELTEST_H - -#include - -class DirModelTest : public QObject -{ - Q_OBJECT - -private Q_SLOTS: - void initTestCase(); - - // FIXME: Those DirModel tests should be moved to a DirModelTest class - void testDirModelSortOrder(); - void testDirModelFavoriteId(); - - void testSortOrder(); -}; - -#endif /* DIRMODELTEST_H */ diff --git a/plasma/applets/homerun/tests/auto/favoriteappsmodeltest.cpp b/plasma/applets/homerun/tests/auto/favoriteappsmodeltest.cpp deleted file mode 100644 index 63fd5446..00000000 --- a/plasma/applets/homerun/tests/auto/favoriteappsmodeltest.cpp +++ /dev/null @@ -1,249 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 2 of -the License or (at your option) version 3 or any later version -accepted by the membership of KDE e.V. (or its successor approved -by the membership of KDE e.V.), which shall act as a proxy -defined in Section 14 of version 3 of the license. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ -#include "favoriteappsmodeltest.h" - -// Qt -#include -#include - -// KDE -#include -#include -#include -#include - -#include - -using namespace Homerun; - -QTEST_KDEMAIN(FavoriteAppsModelTest, GUI) - -static void checkRole(QAbstractItemModel *model, int row, int role, const QVariant &expected) -{ - QModelIndex index = model->index(row, 0); - QVERIFY(index.isValid()); - QVariant value = index.data(role); - QCOMPARE(expected, value); -} - -void FavoriteAppsModelTest::writeTestConfig(const QString &content) -{ - QFile file(m_configFileName); - bool ok = file.open(QIODevice::WriteOnly); - QVERIFY2(ok, "Failed to open test config file for writing"); - file.write(content.toUtf8()); -} - -void FavoriteAppsModelTest::writeTestXml(const QString &content) -{ - QFile file(m_favoriteXmlFileName); - bool ok = file.open(QIODevice::WriteOnly); - QVERIFY2(ok, "Failed to open test xml file for writing"); - file.write(content.toUtf8()); -} - -void FavoriteAppsModelTest::init() -{ - m_favoriteXmlFileName = KStandardDirs::locateLocal("data", "homerun/favoriteapps.xml"); - m_configFileName = KStandardDirs::locateLocal("config", "homerunrc"); - - // Start from a blank state - QFile::remove(m_favoriteXmlFileName); - QFile::remove(m_configFileName); -} - -void FavoriteAppsModelTest::testLoad() -{ - writeTestXml( - "\n" - "\n" - "\n" - ""); - - FavoriteAppsModel model; - - QCOMPARE(model.rowCount(), 2); - - // Test Konqueror row - checkRole(&model, 0, Qt::DisplayRole, "Konqueror"); - checkRole(&model, 0, Qt::DecorationRole, "konqueror"); - checkRole(&model, 0, FavoriteAppsModel::FavoriteIdRole, "app:kde4-konqbrowser.desktop"); - - // Test Dolphin row - checkRole(&model, 1, Qt::DisplayRole, "Dolphin"); - checkRole(&model, 1, Qt::DecorationRole, "system-file-manager"); - checkRole(&model, 1, FavoriteAppsModel::FavoriteIdRole, "app:kde4-dolphin.desktop"); -} - -void FavoriteAppsModelTest::testImport() -{ - QVERIFY(!QFile::exists(m_favoriteXmlFileName)); - writeTestConfig( - "[favorites][favorite-3]\n" - "serviceId=kde4-konqbrowser.desktop\n" - "[favorites][favorite-12]\n" - "serviceId=kde4-konsole.desktop\n" - "[favorites][favorite-8]\n" - "serviceId=kde4-dolphin.desktop\n" - "\n" - "[Group1]\n" - "foo=bar\n" - "[Group2]\n" - "foo=bar\n" - ); - - FavoriteAppsModel model; - QCOMPARE(model.rowCount(), 3); - // Order should be konq (3), dolphin (8), konsole (12) - - // Test Konqueror row - checkRole(&model, 0, Qt::DisplayRole, "Konqueror"); - checkRole(&model, 0, Qt::DecorationRole, "konqueror"); - checkRole(&model, 0, FavoriteAppsModel::FavoriteIdRole, "app:kde4-konqbrowser.desktop"); - - // Test Dolphin row - checkRole(&model, 1, Qt::DisplayRole, "Dolphin"); - checkRole(&model, 1, Qt::DecorationRole, "system-file-manager"); - checkRole(&model, 1, FavoriteAppsModel::FavoriteIdRole, "app:kde4-dolphin.desktop"); - - // Test Konsole row - checkRole(&model, 2, Qt::DisplayRole, "Konsole"); - checkRole(&model, 2, Qt::DecorationRole, "utilities-terminal"); - checkRole(&model, 2, FavoriteAppsModel::FavoriteIdRole, "app:kde4-konsole.desktop"); - - // Check favorites got removed from config file - KSharedConfig::Ptr config = KSharedConfig::openConfig(m_configFileName, KConfig::SimpleConfig); - QStringList list = config->groupList(); - list.sort(); - QCOMPARE(list.count(), 2); - QCOMPARE(list[0], QString("Group1")); - QCOMPARE(list[1], QString("Group2")); -} - -void FavoriteAppsModelTest::testFirstLoad() -{ - QVERIFY(!QFile::exists(m_favoriteXmlFileName)); - QVERIFY(!QFile::exists(m_configFileName)); - - FavoriteAppsModel model; - // model should start with default apps, see data/favoriteapps.xml - QCOMPARE(model.rowCount(), 3); - checkRole(&model, 0, Qt::DisplayRole, "Konqueror"); - checkRole(&model, 1, Qt::DisplayRole, "KMail"); - checkRole(&model, 2, Qt::DisplayRole, "Dolphin"); - - // we should not write the user xml file unless the user makes a change - QVERIFY(!QFile::exists(m_favoriteXmlFileName)); -} - -void FavoriteAppsModelTest::testAdd() -{ - writeTestXml( - "\n" - "\n" - "\n" - ""); - - FavoriteAppsModel model; - - model.addFavorite("app:kde4-konsole.desktop"); - - // Check new favorite is in the model - QCOMPARE(model.rowCount(), 3); - checkRole(&model, 2, Qt::DisplayRole, "Konsole"); - checkRole(&model, 2, Qt::DecorationRole, "utilities-terminal"); - - // Check changes got serialized - FavoriteAppsModel model2; - QCOMPARE(model2.rowCount(), 3); - checkRole(&model2, 2, Qt::DisplayRole, "Konsole"); - checkRole(&model2, 2, Qt::DecorationRole, "utilities-terminal"); -} - -void FavoriteAppsModelTest::testAddToEmptyFavoriteList() -{ - writeTestXml(""); - - FavoriteAppsModel model; - model.addFavorite("app:konsole.desktop"); - - // Check new favorite is in the model - QCOMPARE(model.rowCount(), 1); - checkRole(&model, 0, Qt::DisplayRole, "Konsole"); - checkRole(&model, 0, Qt::DecorationRole, "utilities-terminal"); - - // Check changes got serialized - FavoriteAppsModel model2; - QCOMPARE(model2.rowCount(), 1); - checkRole(&model2, 0, Qt::DisplayRole, "Konsole"); - checkRole(&model2, 0, Qt::DecorationRole, "utilities-terminal"); - -} - -void FavoriteAppsModelTest::testRemove() -{ - writeTestXml( - "\n" - "\n" - "\n" - "\n" - ""); - - FavoriteAppsModel model; - - // Drop Dolphin row - model.removeFavorite("app:kde4-dolphin.desktop"); - - // Check Dolphin has been removed from model - QCOMPARE(model.rowCount(), 2); - checkRole(&model, 1, Qt::DisplayRole, "Konsole"); - - // Check changes got serialized - FavoriteAppsModel model2; - QCOMPARE(model2.rowCount(), 2); - checkRole(&model2, 1, Qt::DisplayRole, "Konsole"); -} - -void FavoriteAppsModelTest::testMove() -{ - QModelIndex index; - writeTestXml( - "\n" - "\n" - "\n" - "\n" - ""); - - FavoriteAppsModel model; - - // Move Dolphin after Konsole - model.moveRow(1, 2); - - // Check model - checkRole(&model, 1, Qt::DisplayRole, "Konsole"); - checkRole(&model, 2, Qt::DisplayRole, "Dolphin"); - - // Check changes got serialized - FavoriteAppsModel model2; - checkRole(&model2, 1, Qt::DisplayRole, "Konsole"); - checkRole(&model2, 2, Qt::DisplayRole, "Dolphin"); -} - -#include "moc_favoriteappsmodeltest.cpp" diff --git a/plasma/applets/homerun/tests/auto/favoriteappsmodeltest.h b/plasma/applets/homerun/tests/auto/favoriteappsmodeltest.h deleted file mode 100644 index dedbbeb6..00000000 --- a/plasma/applets/homerun/tests/auto/favoriteappsmodeltest.h +++ /dev/null @@ -1,47 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 2 of -the License or (at your option) version 3 or any later version -accepted by the membership of KDE e.V. (or its successor approved -by the membership of KDE e.V.), which shall act as a proxy -defined in Section 14 of version 3 of the license. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ -#ifndef FAVORITEAPPSMODELTEST_H -#define FAVORITEAPPSMODELTEST_H - -#include - -class FavoriteAppsModelTest : public QObject -{ - Q_OBJECT - - void writeTestXml(const QString &); - void writeTestConfig(const QString &); - -private Q_SLOTS: - void init(); - void testLoad(); - void testAdd(); - void testAddToEmptyFavoriteList(); - void testRemove(); - void testMove(); - void testImport(); - void testFirstLoad(); - -private: - QString m_favoriteXmlFileName; - QString m_configFileName; -}; - -#endif /* FAVORITEAPPSMODELTEST_H */ diff --git a/plasma/applets/homerun/tests/auto/favoriteplacesmodeltest.cpp b/plasma/applets/homerun/tests/auto/favoriteplacesmodeltest.cpp deleted file mode 100644 index 38e66d5f..00000000 --- a/plasma/applets/homerun/tests/auto/favoriteplacesmodeltest.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 2 of -the License or (at your option) version 3 or any later version -accepted by the membership of KDE e.V. (or its successor approved -by the membership of KDE e.V.), which shall act as a proxy -defined in Section 14 of version 3 of the license. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ -// Self -#include - -// Local -#include - -// KDE -#include -#include -#include -#include - -// Qt -#include - -using namespace Homerun; - -QTEST_KDEMAIN(FavoritePlacesModelTest, NoGUI) - -static void checkRole(QAbstractItemModel *model, int row, int role, const QVariant &expected) -{ - QModelIndex index = model->index(row, 0); - QVERIFY(index.isValid()); - QVariant value = index.data(role); - QCOMPARE(value, expected); -} - -void FavoritePlacesModelTest::init() -{ - QString dir = KGlobal::dirs()->localxdgdatadir(); - QFile::remove(dir + "/user-places.xbel"); - QFile::remove(KStandardDirs::locateLocal("data", "kfileplaces/bookmarks.xml")); -} - -void FavoritePlacesModelTest::testFavoriteId() -{ - FavoritePlacesModel model; - model.addPlace("Foo", KUrl("/foo")); - checkRole(&model, model.rowCount() - 1, FavoritePlacesModel::FavoriteIdRole, "place:file:///foo"); - - model.addPlace("Foo", KUrl("sftp://user@example.com/dir/")); - checkRole(&model, model.rowCount() - 1, FavoritePlacesModel::FavoriteIdRole, "place:sftp://user@example.com/dir/"); -} - -static bool checkOrder(FavoritePlacesModel *model, const QStringList &list) -{ - int startRow = model->count() - list.count(); - for(int idx = 0; idx < list.count(); ++idx) { - QModelIndex index = model->index(startRow + idx, 0); - QString actual = index.data(Qt::DisplayRole).toString(); - QString expected = list[idx]; - if (actual != expected) { - kWarning() << "--- End of model differs from list ---"; - for(int idx = 0; idx < list.count(); ++idx) { - QModelIndex index = model->index(startRow + idx, 0); - QString actual = index.data(Qt::DisplayRole).toString(); - QString expected = list[idx]; - kWarning() << "- actual=" << actual << " expected=" << expected; - } - return false; - } - } - return true; -} - -void FavoritePlacesModelTest::testMoveRow() -{ - FavoritePlacesModel model; - int row1 = model.count(); - model.addPlace("Foo", KUrl("/foo")); - int row2 = model.count(); - model.addPlace("Bar", KUrl("/bar")); - model.addPlace("Baz", KUrl("/baz")); - - QVERIFY(checkOrder(&model, QStringList() << "Foo" << "Bar" << "Baz")); - - // Move "Foo" after "Bar" - model.moveRow(row1, row2); - QVERIFY(checkOrder(&model, QStringList() << "Bar" << "Foo" << "Baz")); - - // Move "Foo" back before "Bar" - model.moveRow(row2, row1); - QVERIFY(checkOrder(&model, QStringList() << "Foo" << "Bar" << "Baz")); -} - -#include "moc_favoriteplacesmodeltest.cpp" diff --git a/plasma/applets/homerun/tests/auto/favoriteplacesmodeltest.h b/plasma/applets/homerun/tests/auto/favoriteplacesmodeltest.h deleted file mode 100644 index 9c283bbe..00000000 --- a/plasma/applets/homerun/tests/auto/favoriteplacesmodeltest.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 2 of -the License or (at your option) version 3 or any later version -accepted by the membership of KDE e.V. (or its successor approved -by the membership of KDE e.V.), which shall act as a proxy -defined in Section 14 of version 3 of the license. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ -#ifndef FAVORITEPLACESMODELTEST_H -#define FAVORITEPLACESMODELTEST_H - -// Local - -// Qt -#include - -// KDE - -/** - * - */ -class FavoritePlacesModelTest : public QObject -{ - Q_OBJECT -private Q_SLOTS: - void init(); - void testFavoriteId(); - void testMoveRow(); -}; - -#endif /* FAVORITEPLACESMODELTEST_H */ diff --git a/plasma/applets/homerun/tests/auto/i18nconfigtest.cpp b/plasma/applets/homerun/tests/auto/i18nconfigtest.cpp deleted file mode 100644 index 16af9fc9..00000000 --- a/plasma/applets/homerun/tests/auto/i18nconfigtest.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* -Copyright 2013 Aurélien Gâteau - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 2 of -the License or (at your option) version 3 or any later version -accepted by the membership of KDE e.V. (or its successor approved -by the membership of KDE e.V.), which shall act as a proxy -defined in Section 14 of version 3 of the license. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ -#include "i18nconfigtest.h" - -// Local -// We include a .cpp. This is not a mistake. Content of this file is not really used. -#include - -// KDE -#include -#include -#include - -// Qt - -QTEST_KDEMAIN(I18nConfigTest, NoGUI) - -void I18nConfigTest::test() -{ - KConfig config(QString(KDESRCDIR) + "/../../config/homerunrc"); - QStringList tabs = config.group("General").readEntry("tabs", QStringList()); - QVERIFY(!tabs.isEmpty()); - - Q_FOREACH(const QString &tabGroupName, tabs) { - KConfigGroup group = config.group(tabGroupName); - QVERIFY(group.exists()); - QString name = group.readEntry("name"); - QVERIFY(!name.isEmpty()); - - // Check name is marked for translation - QVERIFY(sTabNames.contains(name)); - } -} - -#include "moc_i18nconfigtest.cpp" diff --git a/plasma/applets/homerun/tests/auto/i18nconfigtest.h b/plasma/applets/homerun/tests/auto/i18nconfigtest.h deleted file mode 100644 index 6c217d65..00000000 --- a/plasma/applets/homerun/tests/auto/i18nconfigtest.h +++ /dev/null @@ -1,37 +0,0 @@ -/* -Copyright 2013 Aurélien Gâteau - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 2 of -the License or (at your option) version 3 or any later version -accepted by the membership of KDE e.V. (or its successor approved -by the membership of KDE e.V.), which shall act as a proxy -defined in Section 14 of version 3 of the license. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ -#ifndef I18NCONFIGTEST_H -#define I18NCONFIGTEST_H - -#include - -/** - * This test checks strings which need to be translated in config/homerunrc are - * marked as translatable in internal/i18nconfig.cpp - */ -class I18nConfigTest : public QObject -{ - Q_OBJECT - -private Q_SLOTS: - void test(); -}; - -#endif /* I18NCONFIGTEST_H */ diff --git a/plasma/applets/homerun/tests/auto/sourcemodeltest.cpp b/plasma/applets/homerun/tests/auto/sourcemodeltest.cpp deleted file mode 100644 index 1fa1e15d..00000000 --- a/plasma/applets/homerun/tests/auto/sourcemodeltest.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 2 of -the License or (at your option) version 3 or any later version -accepted by the membership of KDE e.V. (or its successor approved -by the membership of KDE e.V.), which shall act as a proxy -defined in Section 14 of version 3 of the license. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ -// Self -#include - -// Local -#include -#include - -// KDE -#include - -// Qt -#include - -QTEST_KDEMAIN(SourceModelTest, NoGUI) - -class MockRegistry : public Homerun::AbstractSourceRegistry -{ -public: - QObject *createModelFromConfigGroup(const QString &sourceId, const KConfigGroup &/*configGroup*/, QObject *parent) - { - if (sourceId == "broken") { - return 0; - } - return new QStandardItemModel(parent); - } -}; - -void SourceModelTest::initTestCase() -{ - qRegisterMetaType("QModelIndex"); - m_registry = new MockRegistry(); -} - -void SourceModelTest::cleanupTestCase() -{ - delete m_registry; -} - -void SourceModelTest::testAppendSource() -{ - KConfig config(QString(), KConfig::SimpleConfig); - KConfigGroup group(&config, "Tab0"); - SourceModel model(m_registry, group, 0); - - QCOMPARE(model.rowCount(), 0); - model.appendSource("foo"); - - QCOMPARE(model.rowCount(), 1); - - QCOMPARE(group.readEntry("sources", QStringList()), QStringList() << "Source0"); - - KConfigGroup sourceGroup(&group, "Source0"); - QCOMPARE(sourceGroup.readEntry("sourceId"), QString("foo")); -} - -#include "moc_sourcemodeltest.cpp" diff --git a/plasma/applets/homerun/tests/auto/sourcemodeltest.h b/plasma/applets/homerun/tests/auto/sourcemodeltest.h deleted file mode 100644 index 773b6a60..00000000 --- a/plasma/applets/homerun/tests/auto/sourcemodeltest.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 2 of -the License or (at your option) version 3 or any later version -accepted by the membership of KDE e.V. (or its successor approved -by the membership of KDE e.V.), which shall act as a proxy -defined in Section 14 of version 3 of the license. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ -#ifndef SOURCEMODELTEST_H -#define SOURCEMODELTEST_H - -// Local - -// Qt -#include - -// KDE - -class MockRegistry; - -class SourceModelTest : public QObject -{ - Q_OBJECT - -private Q_SLOTS: - void initTestCase(); - void cleanupTestCase(); - void testAppendSource(); - -private: - MockRegistry *m_registry; -}; - -#endif /* SOURCEMODELTEST_H */ diff --git a/plasma/applets/homerun/tests/auto/tabmodeltest.cpp b/plasma/applets/homerun/tests/auto/tabmodeltest.cpp deleted file mode 100644 index 5cac9c3c..00000000 --- a/plasma/applets/homerun/tests/auto/tabmodeltest.cpp +++ /dev/null @@ -1,664 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 2 of -the License or (at your option) version 3 or any later version -accepted by the membership of KDE e.V. (or its successor approved -by the membership of KDE e.V.), which shall act as a proxy -defined in Section 14 of version 3 of the license. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ -#include "tabmodeltest.h" - -// Local -#include -#include -#include -#include - -// KDE -#include -#include -#include -#include -#include -#include - -// Qt -#include -#include - -QTEST_KDEMAIN(TabModelTest, NoGUI) - -Q_DECLARE_METATYPE(QModelIndex) - -class MockRegistry : public Homerun::AbstractSourceRegistry -{ -public: - QObject *createModelFromConfigGroup(const QString &sourceId, const KConfigGroup &/*configGroup*/, QObject *parent) - { - if (sourceId == "broken") { - return 0; - } - return new QStandardItemModel(parent); - } -}; - -static QStringList getSourceGroups(const QModelIndex &index) -{ - QAbstractItemModel *tabSourceModel = qobject_cast( - index.data(TabModel::SourceModelRole).value() - ); - if (!tabSourceModel) { - kError() << "No tab model"; - return QStringList(); - } - QStringList lst; - for (int row = 0; row < tabSourceModel->rowCount(); ++row) { - QModelIndex index = tabSourceModel->index(row, 0); - KConfigGroup *group = index.data(SourceModel::ConfigGroupRole).value(); - Q_ASSERT(!group->name().isEmpty()); - lst << group->parent().name() + "/" + group->name(); - } - return lst; -} - -static QStringList getTabList(const KSharedConfig::Ptr config) -{ - KConfigGroup group(config, "General"); - return group.readEntry("tabs", QStringList()); -} - -static KTemporaryFile *generateTestFile(const QString &content) -{ - KTemporaryFile *file = new KTemporaryFile; - bool ok = file->open(); - Q_ASSERT(ok); - file->write(content.toUtf8()); - file->flush(); - return file; -} - -void writeFile(const QString &fileName, const QString &content) -{ - QFile file(fileName); - bool ok = file.open(QIODevice::WriteOnly); - Q_ASSERT(ok); - file.write(content.toUtf8()); -} - -static void printFile(const QString &fileName) -{ - QFile file(fileName); - bool ok = file.open(QIODevice::ReadOnly); - Q_ASSERT(ok); - kWarning() << file.readAll(); -} - -void TabModelTest::initTestCase() -{ - qRegisterMetaType("QModelIndex"); - m_registry = new MockRegistry(); -} - -void TabModelTest::cleanupTestCase() -{ - delete m_registry; -} - -void TabModelTest::testTabOrder() -{ - QScopedPointer temp(generateTestFile( - "[General]\n" - "tabs=Tab0,Tab1,Tab2,Tab3,Tab4,Tab5,Tab6\n" - "[Tab0]\n" - "name=tab0\n" - "sources=Source0\n" - "[Tab0][Source0]\n" - "sourceId=foo\n" - "\n" - "[Tab5]\n" - "name=tab5\n" - "sources=Source0\n" - "[Tab5][Source0]\n" - "sourceId=foo\n" - "\n" - "[Tab4]\n" - "name=tab4\n" - "sources=Source0\n" - "[Tab4][Source0]\n" - "sourceId=foo\n" - "\n" - "[Tab2]\n" - "name=tab2\n" - "sources=Source0\n" - "[Tab2][Source0]\n" - "sourceId=foo\n" - "\n" - "[Tab3]\n" - "name=tab3\n" - "sources=Source0\n" - "[Tab3][Source0]\n" - "sourceId=foo\n" - "\n" - "[Tab6]\n" - "name=tab6\n" - "sources=Source0\n" - "[Tab6][Source0]\n" - "sourceId=foo\n" - "\n" - "[Tab1]\n" - "name=tab1\n" - "sources=Source0\n" - "[Tab1][Source0]\n" - "sourceId=foo\n" - "\n" - )); - - KSharedConfig::Ptr config = KSharedConfig::openConfig(temp->fileName()); - TabModel model; - model.setSourceRegistry(m_registry); - model.setConfig(config); - - QCOMPARE(model.rowCount(), 7); - - for (int row = 0; row < 7; ++row) { - QModelIndex index = model.index(row, 0); - QCOMPARE(index.data(Qt::DisplayRole).toString(), QString("tab%1").arg(row)); - } -} - -void TabModelTest::testLoadKeys_data() -{ - QTest::addColumn("configText"); - QTest::addColumn("name"); - QTest::addColumn("iconName"); - QTest::addColumn("sources"); - - QTest::newRow("name+icon") - << "[General]\n" - "tabs=Tab0\n" - "[Tab0]\n" - "name=tab0\n" - "icon=icon0\n" - "sources=Source0\n" - "[Tab0][Source0]\n" - "sourceId=foo\n" - << "tab0" - << "icon0" - << (QStringList() << "Tab0/Source0"); - - QTest::newRow("name-only") - << "[General]\n" - "tabs=Tab0\n" - "[Tab0]\n" - "name=tab0\n" - "sources=Source0\n" - "[Tab0][Source0]\n" - "sourceId=foo\n" - << "tab0" - << QString() - << (QStringList() << "Tab0/Source0"); - - QTest::newRow("unnamed") - << "[General]\n" - "tabs=Tab0\n" - "[Tab0]\n" - "sources=Source0\n" - "[Tab0][Source0]\n" - "sourceId=foo\n" - << "" - << QString() - << (QStringList() << "Tab0/Source0"); - - QTest::newRow("multi-sources") - << "[General]\n" - "tabs=Tab0\n" - "[Tab0]\n" - "name=tab0\n" - "sources=Source0,Source1\n" - "[Tab0][Source0]\n" - "sourceId=foo\n" - "[Tab0][Source1]\n" - "sourceId=bar\n" - << "tab0" - << QString() - << (QStringList() << "Tab0/Source0" << "Tab0/Source1"); - - QTest::newRow("no-sources") - << "[General]\n" - "tabs=Tab0\n" - "[Tab0]\n" - "name=tab0\n" - << "tab0" - << QString() - << QStringList(); -} - -void TabModelTest::testLoadKeys() -{ - QFETCH(QString, configText); - QFETCH(QString, name); - QFETCH(QString, iconName); - QFETCH(QStringList, sources); - - // Create config file - QScopedPointer temp(generateTestFile(configText)); - KSharedConfig::Ptr config = KSharedConfig::openConfig(temp->fileName()); - - // Load it - TabModel model; - model.setSourceRegistry(m_registry); - model.setConfig(config); - - QCOMPARE(model.rowCount(), 1); - - QModelIndex index = model.index(0, 0); - QCOMPARE(index.data(Qt::DisplayRole).toString(), name); - QCOMPARE(index.data(Qt::DecorationRole).toString(), iconName); - QStringList lst = getSourceGroups(index); - QCOMPARE(sources, lst); -} - -void TabModelTest::testSetDataForRow() -{ - QString configText = - "[General]\n" - "tabs=Tab0,Tab1\n" - "" - "[Tab0]\n" - "name=first\n" - "sources=Source0\n" - "[Tab0][Source0]\n" - "sourceId=foo\n" - "" - "[Tab1]\n" - "name=second\n" - "sources=Source0\n" - "[Tab1][Source0]\n" - "sourceId=bar\n" - ; - QScopedPointer temp(generateTestFile(configText)); - KSharedConfig::Ptr config = KSharedConfig::openConfig(temp->fileName()); - - // Load it - TabModel model; - model.setSourceRegistry(m_registry); - model.setConfig(config); - - QCOMPARE(model.rowCount(), 2); - - QSignalSpy spy(&model, SIGNAL(dataChanged(QModelIndex, QModelIndex))); - model.setDataForRow(1, "display", "last"); - model.setDataForRow(1, "decoration", "document-new"); - - QModelIndex index = model.index(1, 0); - QCOMPARE(index.data(Qt::DisplayRole).toString(), QString("last")); - QCOMPARE(index.data(Qt::DecorationRole).toString(), QString("document-new")); - - QCOMPARE(spy.count(), 2); - QVariantList args = spy.takeFirst(); - QModelIndex topLeft = args[0].value(); - QModelIndex bottomRight = args[1].value(); - QCOMPARE(topLeft.row(), 1); - QCOMPARE(bottomRight.row(), 1); - QCOMPARE(topLeft.column(), 0); - QCOMPARE(bottomRight.column(), 0); -} - -void TabModelTest::testAppendRow() -{ - QString configText = - "[General]\n" - "tabs=Tab0\n" - "" - "[Tab0]\n" - "name=first\n" - "sources=Source0\n" - "" - "[Tab0][Source0]\n" - "sourceId=foo\n" - ; - QScopedPointer temp(generateTestFile(configText)); - KSharedConfig::Ptr config = KSharedConfig::openConfig(temp->fileName()); - - // Load it - TabModel model; - model.setSourceRegistry(m_registry); - model.setConfig(config); - QCOMPARE(model.rowCount(), 1); - - QSignalSpy aboutInsertedSpy(&model, SIGNAL(rowsAboutToBeInserted(QModelIndex, int, int))); - QSignalSpy insertedSpy(&model, SIGNAL(rowsInserted(QModelIndex, int, int))); - - // Append row - model.appendRow(); - - // Check model - QCOMPARE(model.rowCount(), 2); - QVariant sourceModelVariant = model.index(1, 0).data(TabModel::SourceModelRole); - QVERIFY(sourceModelVariant.value()); - - // Check config - QVERIFY(config->hasGroup("Tab1")); - QVERIFY(config->group("Tab1").hasKey("name")); - QString name = config->group("Tab1").readEntry("name"); - QCOMPARE(name, QString()); - QCOMPARE(getTabList(config), QStringList() << "Tab0" << "Tab1"); - - // Check signals - QCOMPARE(aboutInsertedSpy.count(), 1); - QVariantList args = aboutInsertedSpy.takeFirst(); - QVERIFY(!args[0].value().isValid()); - QCOMPARE(args[1].toInt(), 1); - QCOMPARE(args[2].toInt(), 1); - - QCOMPARE(insertedSpy.count(), 1); - args = insertedSpy.takeFirst(); - QVERIFY(!args[0].value().isValid()); - QCOMPARE(args[1].toInt(), 1); - QCOMPARE(args[2].toInt(), 1); -} - -void TabModelTest::testRemoveRow() -{ - QString configText = - "[General]\n" - "tabs=Tab0,Tab1\n" - "\n" - "[Tab0]\n" - "name=first\n" - "sources=foo\n" - "\n" - "[Tab1]\n" - "name=second\n" - "sources=bar\n" - ; - QScopedPointer temp(generateTestFile(configText)); - KSharedConfig::Ptr config = KSharedConfig::openConfig(temp->fileName()); - - // Load it - TabModel model; - model.setSourceRegistry(m_registry); - model.setConfig(config); - QCOMPARE(model.rowCount(), 2); - - // Remove row - QSignalSpy aboutRemovedSpy(&model, SIGNAL(rowsAboutToBeRemoved(QModelIndex, int, int))); - QSignalSpy removedSpy(&model, SIGNAL(rowsRemoved(QModelIndex, int, int))); - model.removeRow(0); - QCOMPARE(model.rowCount(), 1); - - // Check config file - QVERIFY(config->group("Tab0").readEntry("deleted", false)); - QVERIFY(!config->group("Tab1").readEntry("deleted", false)); - QCOMPARE(getTabList(config), QStringList() << "Tab1"); - - // Check signals - QCOMPARE(aboutRemovedSpy.count(), 1); - QVariantList args = aboutRemovedSpy.takeFirst(); - QVERIFY(!args[0].value().isValid()); - QCOMPARE(args[1].toInt(), 0); - QCOMPARE(args[2].toInt(), 0); - - QCOMPARE(removedSpy.count(), 1); - args = removedSpy.takeFirst(); - QVERIFY(!args[0].value().isValid()); - QCOMPARE(args[1].toInt(), 0); - QCOMPARE(args[2].toInt(), 0); - - // Load again - TabModel model2; - model2.setSourceRegistry(m_registry); - model2.setConfig(config); - QCOMPARE(model2.rowCount(), 1); -} - -void TabModelTest::testMoveRow_data() -{ - QTest::addColumn("from"); - QTest::addColumn("to"); - - QTest::newRow("2to1") << 2 << 1; - QTest::newRow("1to2") << 1 << 2; -} - -static QMap getEntries(KSharedConfig::Ptr config, const QString &tabName) -{ - return config->group(tabName).entryMap(); -} - -void TabModelTest::testMoveRow() -{ - QFETCH(int, from); - QFETCH(int, to); - - QString configText = - "[General]\n" - "tabs=Tab0,Tab1,Tab2\n" - "\n" - "[Tab0]\n" - "name=zero\n" - "sources=tab0-0,tab0-1,tab0-2\n" - "\n" - "[Tab1]\n" - "name=one\n" - "icon=iconOne\n" - "sources=tab1-0,tab1-1\n" - "\n" - "[Tab2]\n" - "name=two\n" - "icon=iconTwo\n" - "sources=tab2-0\n" - ; - QScopedPointer temp(generateTestFile(configText)); - KSharedConfig::Ptr config = KSharedConfig::openConfig(temp->fileName()); - - // Load it - TabModel model; - model.setSourceRegistry(m_registry); - model.setConfig(config); - QCOMPARE(model.rowCount(), 3); - - QStringList beforeTabs = getTabList(config); - QMap beforeFrom = getEntries(config, beforeTabs.at(from)); - QMap beforeTo = getEntries(config, beforeTabs.at(to)); - QStringList beforeFromSources = getSourceGroups(model.index(from, 0)); - QVERIFY(!beforeFromSources.isEmpty()); - QStringList beforeToSources = getSourceGroups(model.index(to, 0)); - QVERIFY(!beforeToSources.isEmpty()); - - QSignalSpy aboutSpy(&model, SIGNAL(rowsAboutToBeMoved(QModelIndex, int, int, QModelIndex, int))); - QSignalSpy spy(&model, SIGNAL(rowsMoved(QModelIndex, int, int, QModelIndex, int))); - model.moveRow(from, to); - - // Check model - QModelIndex index; - index = model.index(to, 0); - QCOMPARE(index.data(Qt::DisplayRole).toString(), beforeFrom.value("name")); - QCOMPARE(getSourceGroups(index), beforeFromSources); - index = model.index(from, 0); - QCOMPARE(index.data(Qt::DisplayRole).toString(), beforeTo.value("name")); - QCOMPARE(getSourceGroups(index), beforeToSources); - - // Check config - QStringList afterTabs = getTabList(config); - QStringList expectedTabs = beforeTabs; - expectedTabs.swap(from, to); - QCOMPARE(afterTabs, expectedTabs); - - // Check signals - int modelTo = to + (to > from ? 1 : 0); - QVariantList args; - QCOMPARE(aboutSpy.count(), 1); - args = aboutSpy.takeFirst(); - QVERIFY(!args[0].value().isValid()); - QCOMPARE(args[1].toInt(), from); - QCOMPARE(args[2].toInt(), from); - QVERIFY(!args[3].value().isValid()); - QCOMPARE(args[4].toInt(), modelTo); - - QCOMPARE(spy.count(), 1); - args = spy.takeFirst(); - QVERIFY(!args[0].value().isValid()); - QCOMPARE(args[1].toInt(), from); - QCOMPARE(args[2].toInt(), from); - QVERIFY(!args[3].value().isValid()); - QCOMPARE(args[4].toInt(), modelTo); - - // Reload config - TabModel model2; - model2.setSourceRegistry(m_registry); - model2.setConfig(config); - QMap afterFrom = getEntries(config, afterTabs.at(from)); - QMap afterTo = getEntries(config, afterTabs.at(to)); - QCOMPARE(beforeFrom, afterTo); - QCOMPARE(beforeTo, afterFrom); - QStringList afterFromSources = getSourceGroups(model2.index(from, 0)); - QStringList afterToSources = getSourceGroups(model2.index(to, 0)); - QCOMPARE(beforeFromSources, afterToSources); - QCOMPARE(beforeToSources, afterFromSources); -} - -void TabModelTest::testAppendRowToEmptyModel() -{ - QScopedPointer temp(generateTestFile(QString())); - KSharedConfig::Ptr config = KSharedConfig::openConfig(temp->fileName()); - - // Load it - TabModel model; - model.setSourceRegistry(m_registry); - model.setConfig(config); - QCOMPARE(model.rowCount(), 0); - - // Append row - model.appendRow(); - - // Check model - QCOMPARE(model.rowCount(), 1); - - QStringList tabList = getTabList(config); - QCOMPARE(tabList, QStringList() << "Tab0"); -} - -void TabModelTest::testResetConfig() -{ - KSharedConfig::Ptr config; - // setup system and user configs - KTempDir systemDir; - QString configrc = "testhomerunrc"; - - writeFile(systemDir.name() + configrc, - "[General]\n" - "tabs=Tab0,Tab1,Tab2\n" - "\n" - "[Tab0]\n" - "name=zero\n" - "icon=iconZero\n" - "sources=tab0-0,tab0-1,tab0-2\n" - "\n" - "[Tab1]\n" - "name=one\n" - "icon=iconOne\n" - "sources=tab1-0,tab1-1\n" - "\n" - "[Tab2]\n" - "name=two\n" - "icon=iconTwo\n" - "sources=Source0\n" - "\n" - "[Tab2][Source0]\n" - "sourceId=ShipList\n" - "includeMotherShip=true\n" - ); - - writeFile(KStandardDirs::locateLocal("config", configrc), - "[General]\n" - "tabs=Tab0,Tab2,Tab3,Tab5\n" - "\n" - "[Tab0]\n" - "name=Foo\n" - "sources=tab0-0,tab0-2\n" - "\n" - "[Tab1]\n" - "name[$d]\n" - "sources[$d]\n" - "\n" - "[Tab2]\n" - "name=Bar\n" - "icon=iconBar\n" - "sources=Source0,Source1\n" - "\n" - "[Tab2][Source0]\n" - "sourceId=CarList\n" - "\n" - "[Tab3]\n" - "name=Baz\n" - "icon=iconBaz\n" - "sources=tab3-0\n" - "\n" - "[Tab4]\n" - "name[$d]\n" - "sources[$d]\n" - "\n" - "[Tab5]\n" - "name=Boom\n" - "icon=iconBoom\n" - "sources=Source1\n" - "\n" - "[Tab5][Source1]\n" - "sourceId=CylonStatus\n" - "detailLevel=4\n" - ); - KGlobal::dirs()->addResourceDir("config", systemDir.name()); - config = KSharedConfig::openConfig(configrc); - - // Create model from config - TabModel model; - model.setSourceRegistry(m_registry); - model.setConfig(config); - - // Reset config, we should be back to the system config - model.resetConfig(); - - if (0) { - printFile(KStandardDirs::locateLocal("config", configrc)); - } - - // Check model - QCOMPARE(model.rowCount(), 3); - QModelIndex index; - - index = model.index(0, 0); - QCOMPARE(index.data(Qt::DisplayRole).toString(), QString("zero")); - QCOMPARE(index.data(Qt::DecorationRole).toString(), QString("iconZero")); - QCOMPARE(getSourceGroups(index), QStringList() << "Tab0/tab0-0" << "Tab0/tab0-1" << "Tab0/tab0-2"); - - index = model.index(1, 0); - QCOMPARE(index.data(Qt::DisplayRole).toString(), QString("one")); - QCOMPARE(index.data(Qt::DecorationRole).toString(), QString("iconOne")); - QCOMPARE(getSourceGroups(index), QStringList() << "Tab1/tab1-0" << "Tab1/tab1-1"); - - index = model.index(2, 0); - QCOMPARE(index.data(Qt::DisplayRole).toString(), QString("two")); - QCOMPARE(index.data(Qt::DecorationRole).toString(), QString("iconTwo")); - QCOMPARE(getSourceGroups(index), QStringList() << "Tab2/Source0"); - QAbstractItemModel *sourceModel = qobject_cast(index.data(TabModel::SourceModelRole).value()); - Q_ASSERT(sourceModel); - QCOMPARE(sourceModel->rowCount(QModelIndex()), 1); - QCOMPARE(sourceModel->index(0, 0).data(SourceModel::SourceIdRole).toString(), QString("ShipList")); - - // Check config file - QCOMPARE(getTabList(config), QStringList() << "Tab0" << "Tab1" << "Tab2"); -} - -#include "moc_tabmodeltest.cpp" diff --git a/plasma/applets/homerun/tests/auto/tabmodeltest.h b/plasma/applets/homerun/tests/auto/tabmodeltest.h deleted file mode 100644 index e3f903da..00000000 --- a/plasma/applets/homerun/tests/auto/tabmodeltest.h +++ /dev/null @@ -1,53 +0,0 @@ -/* -Copyright 2012 Aurélien Gâteau - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 2 of -the License or (at your option) version 3 or any later version -accepted by the membership of KDE e.V. (or its successor approved -by the membership of KDE e.V.), which shall act as a proxy -defined in Section 14 of version 3 of the license. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ -#ifndef TABMODELTEST_H -#define TABMODELTEST_H - -#include - -class MockRegistry; - -class TabModelTest : public QObject -{ - Q_OBJECT - -private Q_SLOTS: - void initTestCase(); - void cleanupTestCase(); - - void testTabOrder(); - void testLoadKeys(); - void testLoadKeys_data(); - - void testSetDataForRow(); - - void testAppendRow(); - void testRemoveRow(); - void testMoveRow_data(); - void testMoveRow(); - void testAppendRowToEmptyModel(); - - void testResetConfig(); - -private: - MockRegistry *m_registry; -}; - -#endif /* TABMODELTEST_H */ diff --git a/plasma/applets/homerun/tests/manual/keyboard-navigation.md b/plasma/applets/homerun/tests/manual/keyboard-navigation.md deleted file mode 100644 index 0726c10f..00000000 --- a/plasma/applets/homerun/tests/manual/keyboard-navigation.md +++ /dev/null @@ -1,51 +0,0 @@ -# startup - -- Focus is on search field -- Press enter => first item of current page is triggered - -# searchFieldAndTabs - -- Focus is on search field -- Pressing tab or down => first item of current page is focused -- Pressing tab (from any row) up (from first row) => search field is focused - -# tabs - -- Focus is on tab1 -- Press page-down => tab2 is current, first item of tab2 is focused - -# sourceNavigation - -- Using arrow keys within source changes the focused item accordingly - -# interSourceNavigation - -- Pressing up/down arrow when on first/last row of source moves focus - to previous/next source, preferably to item in the same column, - otherwise to last item in column - -- Pressing left/right arrow on first/last row of source moves focus to - last/first item of previous/next source - -# browsableSource - -- Go to a browsable source (Dir, FavoritePlaces, InstalledApps...) -- Press Return to enter a folder => first item is focused -- Press alt-left to go back => previously focused item is focused -- Press alt-up to go up one level => first item is focused - -# searching - -- Search field is focused -- Enter a search criteria => current page is updated to reflect search -- Press tab or down => first item is focused - -# menu - -- Focus is on search field -- Press tab or down => first item of current page is focused -- Press 'm' or menu key => context menu for item appears -- Press up/down => navigate in context menu -- Press enter - => selected context menu item is triggered - => focus goes back to result item