[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-panel-devel
Subject: Re: KJots on Plasma
From: Stephen Kelly <steveire () gmail ! com>
Date: 2008-09-25 21:38:50
Message-ID: gbh0da$15v$1 () ger ! gmane ! org
[Download RAW message or body]
Aaron J. Seigo wrote:
> On Thursday 25 September 2008, Stephen Kelly wrote:
>> The idea would be that the plasmoid would display either all of your
>> kjots notes, or only a particular kjots book, or notes tagged with a
>> particular
>
> cool!
>
> (i actually maintined kjots in kde3 and gave it its current
> tree-on-the-left- content-on-the-right interface with things like full
> book overview, etc .. Jaison took it further with the start of rich text
> editting and the initial kde4 port .. so cool to see this app continue on!
> it got its start in kde1 .. yes *ONE*.. =)
Yep, 11 years: http://websvn.kde.org/?view=rev&revision=155 That's probably
before 1.0.
>
>> Syncronization:
>> KJots has been a KUniqueApplication since before I started working on it.
>> This is presumably so that two running KJots instances can not have out
>> of sync edits to the same page.
>
> yes, that's correct.
>
>> However if pages can be edited in a plasmoid,
>> that would be possible. I *think* that if I write an akonadi resource for
>> kjots, akonadi would keep all views on the data up to date (
>> http://thread.gmane.org/gmane.comp.kde.devel.pim/22743). If someone else
>> is more familiar with this kind of thing and whether akonadi is needed at
>> all, please let me know.
>
> that'd be a question for the pimsters.. i *think* the answer is "yes,
> that's correct" but they'd know better than me =)
Seems to be it exactly. I asked about the case where you have two plasmoids
displaying the same page for edit, and you drag text from one to the other.
<steveire> Does akonadi take care of a case where I have two plasmoids
displaying the same page for edit, and I drag text from one to the other?
<till> steveire: if you use the models in both plasmoids, yes, but I guess
the data bakcends for the plasmoid need to handle it too
>
>> Using existing code:
>> There is already a KJotsComponent which is a QWidget contains all the
>> functionality in kjots. It is used by the standalone application and by
>> the kpart which gets loaded in kontact. I think I read that plasma can
>> use QWidgets directly because of QGraphicsView(?). Does that mean that I
>> can simply put that widget into a plasmoid and I'll be finished?
>
> yes, that's about it; i'd recommend using a Plasm::PopupApplet, so when it
> is in the panel you'll get a button to click on that will show the content
> in a popup.
I tried putting the KJotsComponent into a plasmoid. I got it to compile, but
I didn't get it to work. I just get a black box when I try to load it with
plasmoidviewer.
It might just be that that component is not suitable to be used in this way.
I could possibly use the plasma widgets if that's the case. I've attached
my attempt in case I've done anything obviously wrong.
Cheers,
Steve.
["kjotsplasmoidFirstTry.patch" (text/x-diff)]
Index: kjots-plasmoid.h
===================================================================
--- kjots-plasmoid.h (revision 0)
+++ kjots-plasmoid.h (revision 0)
@@ -0,0 +1,33 @@
+// Here we avoid loading the header multiple times
+#ifndef KJOTSPLASMOID_H
+#define KJOTSPLASMOID_H
+// We need the Plasma Applet headers
+#include <KIcon>
+
+#include <Plasma/PopupApplet>
+#include <Plasma/Svg>
+
+
+class KJotsComponent;
+
+
+// Define our plasma Applet
+class KJotsPlasmoid : public Plasma::PopupApplet
+{
+Q_OBJECT
+public:
+ // Basic Create/Destroy
+ KJotsPlasmoid(QObject *parent, const QVariantList &args);
+ virtual ~KJotsPlasmoid();
+
+ virtual QWidget *widget();
+
+private:
+ KJotsComponent *c;
+ QWidget *w;
+};
+
+// This is the command that links your applet to the .desktop file
+K_EXPORT_PLASMA_APPLET(kjots, KJotsPlasmoid)
+
+#endif
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt (revision 861669)
+++ CMakeLists.txt (working copy)
@@ -64,3 +64,49 @@
install( FILES kjotspartui.rc DESTINATION ${DATA_INSTALL_DIR}/kjots)
install(TARGETS kjotspart DESTINATION ${PLUGIN_INSTALL_DIR} )
+
+
+#########################################################################
+# Plasmoid SECTION
+#########################################################################
+
+find_package(Plasma REQUIRED)
+
+add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
+include_directories(
+ ${CMAKE_SOURCE_DIR}
+ ${CMAKE_BINARY_DIR}
+ ${KDE4_INCLUDES}
+ )
+
+# We add our source code here
+set(kjots_plasmoid_SRCS
+ kjots-plasmoid.cpp
+ kjotsentry.cpp
+ kjotsedit.cpp
+ kjotsbookmarks.cpp
+ bookshelf.cpp
+ kjotscomponent.cpp
+ kjotsreplacenextdialog.cpp
+ kjotsbrowser.cpp
+ kjotslinkdialog.cpp
+ flatcollectionproxymodel.cpp
+ kjotsbookshelfentryvalidator.cpp
+ KJotsSettings.cpp
+ )
+
+# Now make sure all files get to the right place
+kde4_add_plugin(plasma_applet_kjots ${kjots_plasmoid_SRCS})
+target_link_libraries(plasma_applet_kjots
+ ${PLASMA_LIBS}
+ ${KDE4_KDEUI_LIBS}
+ ${KDE4_KIO_LIBS}
+ )
+
+install(TARGETS plasma_applet_kjots
+ DESTINATION ${PLUGIN_INSTALL_DIR})
+
+install(FILES kjots-plasmoid.desktop
+ DESTINATION ${SERVICES_INSTALL_DIR})
+
+
Index: kjots-plasmoid.cpp
===================================================================
--- kjots-plasmoid.cpp (revision 0)
+++ kjots-plasmoid.cpp (revision 0)
@@ -0,0 +1,34 @@
+
+#include "kjots-plasmoid.h"
+
+#include <KActionCollection>
+
+#include "kjotscomponent.h"
+
+
+KJotsPlasmoid::KJotsPlasmoid(QObject *parent, const QVariantList &args)
+ : Plasma::PopupApplet(parent, args), c(0)
+{
+// setPopupIcon("kjots");
+}
+
+
+KJotsPlasmoid::~KJotsPlasmoid()
+{
+ delete c;
+}
+
+
+QWidget *KJotsPlasmoid::widget()
+{
+
+ if (!c)
+ {
+ KActionCollection *actionCollection = new KActionCollection(this);
+ c = new KJotsComponent(new QWidget(), actionCollection);
+ c->setMinimumSize( 280, 280 );
+ }
+ return c;
+}
+
+#include "kjots-plasmoid.moc"
Index: kjots-plasmoid.desktop
===================================================================
--- kjots-plasmoid.desktop (revision 0)
+++ kjots-plasmoid.desktop (revision 0)
@@ -0,0 +1,17 @@
+[Desktop Entry]
+Name=KJots plasmoid
+Comment=KJots plasmoid
+Type=Service
+Icon=kjots
+
+X-KDE-ServiceTypes=Plasma/Applet
+X-KDE-Library=plasma_applet_kjots
+X-KDE-PluginInfo-Author=Stephen Kelly
+X-KDE-PluginInfo-Email=steveire@gmail.com
+X-KDE-PluginInfo-Name=kjots-plasmoid
+X-KDE-PluginInfo-Version=0.1
+X-KDE-PluginInfo-Website=http://pim.kde.org/kjots
+X-KDE-PluginInfo-Category=PIM
+X-KDE-PluginInfo-Depends=
+X-KDE-PluginInfo-License=GPL
+X-KDE-PluginInfo-EnabledByDefault=true
_______________________________________________
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic