Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:42.2:Update
kjots
add-kontact-plugin.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File add-kontact-plugin.diff of Package kjots
From b79b87feb090eb50a2831552c27b67366792f6fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Vr=C3=A1til?= <dvratil@kde.org> Date: Tue, 2 Aug 2016 21:06:51 +0200 Subject: Add Kontact plugin for KJots BUG: 359380 FIXED-IN: 5.1.0 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9a03097..b1e8bcf 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -7,6 +7,8 @@ add_subdirectory(noteshared) # it that were used by KJots. We could eventually move this to Akonadi Note add_subdirectory(akonadi_next) +add_subdirectory(kontact_plugin) + add_definitions(-DTRANSLATION_DOMAIN=\"kjots\") configure_file(kjots-version.h.in diff --git a/src/kjotspart.cpp b/src/kjotspart.cpp index fd1e815..606c69a 100644 --- a/src/kjotspart.cpp +++ b/src/kjotspart.cpp @@ -66,7 +66,8 @@ KJotsPart::KJotsPart(QWidget *parentWidget, QObject *parent, const QVariantList initAction(); // set our XML-UI resource file - setXMLFile(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1String("kjots/kjotspartui.rc"))); + setComponentName(QStringLiteral("kjots"), QStringLiteral("kjots")); + setXMLFile(QStringLiteral("kjotspartui.rc")); QTimer::singleShot(0, this, SLOT(delayedInitialization())); } diff --git a/src/kjotspartui.rc b/src/kjotspartui.rc index e732c33..f295706 100644 --- a/src/kjotspartui.rc +++ b/src/kjotspartui.rc @@ -1,5 +1,5 @@ <!DOCTYPE kpartgui> -<kpartgui version="12" name="kjots" > +<kpartgui version="13" name="kjots" > <MenuBar> <Menu name="file"> @@ -56,15 +56,17 @@ <Action name="copyIntoTitle"/> <Action name="linkify"/> </Menu> - + <Action name="bookmarks"/> <Menu noMerge="1" name="settings"> <text>&Settings</text> - <Action name="kjots_configure" group="settings_configure" /> + <DefineGroup append="top_merge" group="top_merge" /> + <Action name="kjots_configure" group="settings_configure" /> </Menu> - <Menu name="help"></Menu> + <Menu name="help"> + </Menu> </MenuBar> <ToolBar name="mainToolBar" fullWidth="true" noMerge="1" iconText="icononly"> diff --git a/src/kjotsui.rc b/src/kjotsui.rc index 298a5fb..cd84aa6 100644 --- a/src/kjotsui.rc +++ b/src/kjotsui.rc @@ -53,12 +53,13 @@ <Action name="insert_image"/> <Action name="copyIntoTitle"/> </Menu> - + <Action name="bookmarks"/> <Menu name="settings"></Menu> - <Menu name="help"></Menu> + <Menu name="help"> + </Menu> </MenuBar> <ToolBar name="mainToolBar" fullWidth="true" noMerge="1" iconText="icononly"> diff --git a/src/kontact_plugin/CMakeLists.txt b/src/kontact_plugin/CMakeLists.txt new file mode 100644 index 0000000..8a6b5e1 --- /dev/null +++ b/src/kontact_plugin/CMakeLists.txt @@ -0,0 +1,14 @@ +include_directories(${kjots_SOURCE_DIR}/src) + +set(kontact_kjots_PART_SRCS + kjots_plugin.cpp +) + +add_library(kontact_kjotsplugin MODULE ${kontact_kjots_PART_SRCS}) +target_link_libraries(kontact_kjotsplugin KF5::KontactInterface) + +install(TARGETS kontact_kjotsplugin DESTINATION ${KDE_INSTALL_PLUGINDIR}) +install(FILES kjotsplugin.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}/kontact) +install(FILES kjots.setdlg DESTINATION ${KDE_INSTALL_DATADIR}/kontact/ksettingsdialog) + +#qt5_add_dbus_interfaces(kontact_akregator_PART_SRCS ${akregator_SOURCE_DIR}/src/org.kde.akregator.part.xml) diff --git a/src/kontact_plugin/kjots.setdlg b/src/kontact_plugin/kjots.setdlg new file mode 100644 index 0000000..7abc381 --- /dev/null +++ b/src/kontact_plugin/kjots.setdlg @@ -0,0 +1,6 @@ +[Notes] +Name=Notes +Comment=Notes +Weight=475 +Icon=kjots + diff --git a/src/kontact_plugin/kjots_plugin.cpp b/src/kontact_plugin/kjots_plugin.cpp new file mode 100644 index 0000000..8e7cc53 --- /dev/null +++ b/src/kontact_plugin/kjots_plugin.cpp @@ -0,0 +1,102 @@ +/* + Copyright (C) 2016 Daniel Vrátil <dvratil@kde.org> + + 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. + + As a special exception, permission is given to link this program + with any edition of Qt, and distribute the resulting executable, + without including the source code for Qt in the source distribution. +*/ + +#include "kjots_plugin.h" +#include "kjotspart.h" +//#include "akregator_options.h" +//#include "partinterface.h" + +#include <KontactInterface/Core> + +#include <QAction> +#include <KActionCollection> +#include <KLocalizedString> +#include <QIcon> +#include <QStandardPaths> + +EXPORT_KONTACT_PLUGIN(KJotsPlugin, kjots) + +KJotsPlugin::KJotsPlugin(KontactInterface::Core *core, const QVariantList &) + : KontactInterface::Plugin(core, core, "kjots") +{ + setComponentName(QStringLiteral("kjots"), QStringLiteral("kjots")); + + mUniqueAppWatcher = new KontactInterface::UniqueAppWatcher( + new KontactInterface::UniqueAppHandlerFactory<KJotsUniqueAppHandler>(), this); +} + +KJotsPlugin::~KJotsPlugin() +{ +} + +void KJotsPlugin::setHelpText(QAction *action, const QString &text) +{ + action->setStatusTip(text); + action->setToolTip(text); + if (action->whatsThis().isEmpty()) { + action->setWhatsThis(text); + } +} + +bool KJotsPlugin::isRunningStandalone() const +{ + return mUniqueAppWatcher->isRunningStandalone(); +} + +QStringList KJotsPlugin::invisibleToolbarActions() const +{ + return { QStringLiteral("new_page"), QStringLiteral("new_book") }; +} + +KParts::ReadOnlyPart *KJotsPlugin::createPart() +{ + KParts::ReadOnlyPart *part = loadPart(); + if (!part) { + return Q_NULLPTR; + } + + return part; +} + +QStringList KJotsPlugin::configModules() const +{ + QStringList modules; + modules << QStringLiteral("PIM/kjots.desktop"); + return modules; +} + + +void KJotsUniqueAppHandler::loadCommandLineOptions(QCommandLineParser *parser) +{ + Q_UNUSED(parser); +} + + +int KJotsUniqueAppHandler::activate(const QStringList &args, const QString &workingDir) +{ + // Ensure part is loaded + (void)plugin()->part(); + + return KontactInterface::UniqueAppHandler::activate(args, workingDir); +} +#include "kjots_plugin.moc" + diff --git a/src/kontact_plugin/kjots_plugin.h b/src/kontact_plugin/kjots_plugin.h new file mode 100644 index 0000000..7c94128 --- /dev/null +++ b/src/kontact_plugin/kjots_plugin.h @@ -0,0 +1,74 @@ +/* + Copyright (C) 2016 Daniel Vrátil <dvratil@kde.org> + + 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 Licensea along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + As a special exception, permission is given to link this program + with any edition of Qt, and distribute the resulting executable, + without including the source code for Qt in the source distribution. +*/ + +#ifndef KJOTS_PLUGIN_H +#define KJOTS_PLUGIN_H + +#include <KontactInterface/UniqueAppHandler> + +namespace KontactInterface +{ +class Plugin; +} + +class KJotsUniqueAppHandler : public KontactInterface::UniqueAppHandler +{ + Q_OBJECT +public: + explicit KJotsUniqueAppHandler(KontactInterface::Plugin *plugin) + : KontactInterface::UniqueAppHandler(plugin) + { + } + + int activate(const QStringList &args, const QString &workingDir) Q_DECL_OVERRIDE; + void loadCommandLineOptions(QCommandLineParser *parser) Q_DECL_OVERRIDE; + +}; + +class KJotsPlugin : public KontactInterface::Plugin +{ + Q_OBJECT + +public: + KJotsPlugin(KontactInterface::Core *core, const QVariantList &); + ~KJotsPlugin(); + + int weight() const Q_DECL_OVERRIDE + { + return 475; + } + + virtual QStringList configModules() const; + bool isRunningStandalone() const Q_DECL_OVERRIDE; + + QStringList invisibleToolbarActions() const Q_DECL_OVERRIDE; + +protected: + KParts::ReadOnlyPart *createPart() Q_DECL_OVERRIDE; + KontactInterface::UniqueAppWatcher *mUniqueAppWatcher; + +private: + void setHelpText(QAction *action, const QString &text); +}; + +#endif + diff --git a/src/kontact_plugin/kjotsplugin.desktop b/src/kontact_plugin/kjotsplugin.desktop new file mode 100644 index 0000000..274489f --- /dev/null +++ b/src/kontact_plugin/kjotsplugin.desktop @@ -0,0 +1,18 @@ +[Desktop Entry] +Type=Service +Icon=kjots +X-KDE-ServiceTypes=Kontact/Plugin,KPluginInfo + +X-KDE-Library=kontact_kjotsplugin +X-KDE-KontactPluginVersion=10 +X-KDE-KontactPartLibraryName=kjotspart +X-KDE-KontactPartExecutableName=kjots +X-KDE-KontactPartLoadOnStart=false + +X-KDE-PluginInfo-Name=kontact_kjotsplugin +X-KDE-PluginInfo-Version=1.0b2 +X-KDE-PluginInfo-License=GPL +X-KDE-PluginInfo-EnabledByDefault=true + +Comment=KJots Plugin +Name=Notes
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor