[Kde-pim] Start of a Kontact::Plugin for KJots

Stephen Kelly steveire at gmail.com
Sun May 18 15:06:26 BST 2008


Getting closer now... :)

Allen Winter wrote:

> On Sunday 18 May 2008 05:09:50 Stephen Kelly wrote:
>> Now that KJots is in kdepim, I'd like some more information on what I
>> need to do to get the Kontact Plugin functional.
>>
>> The problems are:
>> 1) using KStandardDirs::locate("appdata" ...) seems to use 'kontact' as
>> the app name rather than 'kjots', so it looks in the wrong location for
>> kjots files when attempting to load while running in kontact.
> 
> Try using "kjots" instead of "KJots" in the creator as the Plugin ctor
> passes that string to KGlobal::locale()->insertCatalog();

I tried that (and committed it), but it's still not working as expected. I
applied this:
Index: bookshelf.cpp
===================================================================
--- bookshelf.cpp       (revision 809138)
+++ bookshelf.cpp       (working copy)
@@ -134,6 +134,7 @@
 */
 void Bookshelf::loadBooks ( void )
 {
+    kDebug() << KStandardDirs::locateLocal("appdata","");
     QDir dir(KStandardDirs::locateLocal("appdata",""));
     QList<KJotsBook*> books;

When running standalone:
kjots(20059) Bookshelf::loadBooks: "/home/kde-devel/.kde4/share/apps/kjots/"

When running as part of kontact:
kontact(20236)
Bookshelf::loadBooks: "/home/kde-devel/.kde4/share/apps/kontact/"

So it's still trying to load the books from the wrong location. 

> 
>>
>> 2) KJots should have only one instance running. Currently another
>> instance of it is started if the plugin is selected in kontact. The
>> behaviour should be the same as that of akregator. Don't start a new
>> instance if it's already running standalone.
> 
> That should be done using UniqueApp stuff.
> It looks like you started adding this to the kjots plugin
> but you have the code commented-out.

I uncommented and implemented the class for this, so it seems to be working
fine now. Cheers.

> 
>>
>> So:
>> Do I need to write a dbus interface for kjots to solve these issues? As I
>> currently know zero about what dbus even is, I don't want to start doing
>> that unless it will actually solve these issues and is the only way.
>>
>> If not dbus is there something else I'm missing from looking at the other
>> plugins that's making kjots look in the wrong location for books?
>>
> Shouldn't need dbus unless/until you want other apps to be able to
> communicate with kjots.

I tried to implement an action to put 'New KJots Page' into the kontact
drop-down menu, but I can't seem to get that to work. Does that need a dbus
interface written to work?

Index: kjotspart.cpp
===================================================================
--- kjotspart.cpp       (revision 809138)
+++ kjotspart.cpp       (working copy)
@@ -80,6 +80,12 @@
 {
     return false;
 }
+
+void KJotsPart::newPage()
+{
+    component->newPage();
+}
+
 //
 // bool KJotsPart::saveFile()
 // {
Index: kjotscomponent.h
===================================================================
--- kjotscomponent.h    (revision 809138)
+++ kjotscomponent.h    (working copy)
@@ -78,6 +78,7 @@
     public slots:
         void updateCaption();
         void updateMenu();
+        void newPage();

     signals:
         void captionChanged(QString);
@@ -89,7 +90,6 @@
         void deleteBook();
         void deletePage();
         void deleteMultiple();
-        void newPage();
         void onRenameEntry();
         void configure();
         void updateConfiguration();
Index: kjotspart.h
===================================================================
--- kjotspart.h (revision 809138)
+++ kjotspart.h (working copy)
@@ -59,6 +59,9 @@

     static KAboutData *createAboutData();

+public slots:
+    void newPage();
+
 protected:
     /**
      * This must be implemented by each part

kde-devel at wopr:~/kde/src/KDE/kdepim/kontact/plugins/kjots$ mi
makeobj[0]: Entering directory
`/home/kde-devel/kde/build/KDE/kdepim/kontact/plugins/kjots'
Built target kontactinterfaces
Scanning dependencies of target kontact_kjotsplugin
Building CXX object
kontact/plugins/kjots/CMakeFiles/kontact_kjotsplugin.dir/kjots_plugin.o
Linking CXX shared module ../../../lib/kontact_kjotsplugin.so
Built target kontact_kjotsplugin
Linking CXX shared module CMakeFiles/CMakeRelink.dir/kontact_kjotsplugin.so
Install the project...
-- Install configuration: "RelWithDebInfo"
-- Installing /home/kde-devel/kde/lib/kde4/kontact_kjotsplugin.so
--
Installing /home/kde-devel/kde/share/kde4/services/kontact/kjots_plugin.desktop
makeobj[0]: Leaving directory
`/home/kde-devel/kde/build/KDE/kdepim/kontact/plugins/kjots'
kde-devel at wopr:~/kde/src/KDE/kdepim/kontact/plugins/kjots$ mi
makeobj[0]: Entering directory
`/home/kde-devel/kde/build/KDE/kdepim/kontact/plugins/kjots'
Built target kontactinterfaces
Scanning dependencies of target kontact_kjotsplugin
Building CXX object
kontact/plugins/kjots/CMakeFiles/kontact_kjotsplugin.dir/kjots_plugin.o
Linking CXX shared module ../../../lib/kontact_kjotsplugin.so
CMakeFiles/kontact_kjotsplugin.dir/kjots_plugin.o: In function
`KJotsPlugin::newPage()':
/home/kde-devel/kde/src/KDE/kdepim/kontact/plugins/kjots/kjots_plugin.cpp:92:
undefined reference to `typeinfo for KJotsPart'
/home/kde-devel/kde/src/KDE/kdepim/kontact/plugins/kjots/kjots_plugin.cpp:94:
undefined reference to `KJotsPart::newPage()'





All the best,

Steve.


_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/



More information about the kde-pim mailing list