[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kdepim] sendlateragent:  interface to add new item
From:       Montel Laurent <montel () kde ! org>
Date:       2013-04-30 18:48:01
Message-ID: 20130430184801.11589A603F () git ! kde ! org
[Download RAW message or body]

Git commit 505c79e85e6b66f4893a106a97bed3c79f7fec13 by Montel Laurent.
Committed on 30/04/2013 at 20:47.
Pushed by mlaurent into branch 'master'.

interface to add new item

M  +4    -0    sendlateragent/org.freedesktop.Akonadi.SendLaterAgent.xml
M  +23   -0    sendlateragent/sendlateragent.cpp
M  +1    -1    sendlateragent/sendlateragent.h
M  +4    -2    sendlateragent/sendlaterinfo.cpp
M  +1    -1    sendlateragent/sendlaterinfo.h

http://commits.kde.org/kdepim/505c79e85e6b66f4893a106a97bed3c79f7fec13

diff --git a/sendlateragent/org.freedesktop.Akonadi.SendLaterAgent.xml \
b/sendlateragent/org.freedesktop.Akonadi.SendLaterAgent.xml index 6c5c598..923c869 \
                100644
--- a/sendlateragent/org.freedesktop.Akonadi.SendLaterAgent.xml
+++ b/sendlateragent/org.freedesktop.Akonadi.SendLaterAgent.xml
@@ -4,5 +4,9 @@
     <method name="showConfigureDialog" >
       <arg direction="in" type="x" name="windowId" />
     </method>
+    <method name="addSendLaterItem" >
+      <arg name="item" type="x" direction="in"/>
+      <arg direction="in" type="x" name="windowId" />
+    </method>
   </interface>
 </node>
diff --git a/sendlateragent/sendlateragent.cpp b/sendlateragent/sendlateragent.cpp
index ad873e0..a8360d1 100644
--- a/sendlateragent/sendlateragent.cpp
+++ b/sendlateragent/sendlateragent.cpp
@@ -18,6 +18,8 @@
 #include "sendlateragent.h"
 #include "sendlatermanager.h"
 #include "sendlaterconfiguredialog.h"
+#include "sendlaterdialog.h"
+#include "sendlaterinfo.h"
 #include "sendlateragentadaptor.h"
 
 #include <akonadi/dbusconnectionpool.h>
@@ -42,6 +44,27 @@ SendLaterAgent::~SendLaterAgent()
 {
 }
 
+void SendLaterAgent::addSendLaterItem(qlonglong itemId, qlonglong windowId)
+{
+    SendLaterInfo *info = new SendLaterInfo;
+    info->setItemId(itemId);
+    QPointer<SendLaterDialog> dialog = new SendLaterDialog(info);
+    if (windowId) {
+#ifndef Q_WS_WIN
+        KWindowSystem::setMainWindow( dialog, windowId );
+#else
+        KWindowSystem::setMainWindow( dialog, (HWND)windowId );
+#endif
+    }
+    if (dialog->exec()) {
+        //Save ? Add ? Load ?
+        //mManager->load();
+    } else {
+        delete info;
+    }
+    delete dialog;
+}
+
 void SendLaterAgent::configure( WId windowId )
 {
     showConfigureDialog(windowId);
diff --git a/sendlateragent/sendlateragent.h b/sendlateragent/sendlateragent.h
index 5f5705a..e6022fe 100644
--- a/sendlateragent/sendlateragent.h
+++ b/sendlateragent/sendlateragent.h
@@ -30,7 +30,7 @@ public:
     ~SendLaterAgent();
 
     void showConfigureDialog(qlonglong windowId = 0);
-
+    void addSendLaterItem(qlonglong itemId, qlonglong windowId = 0);
 public Q_SLOTS:
     void configure( WId windowId );
 private:
diff --git a/sendlateragent/sendlaterinfo.cpp b/sendlateragent/sendlaterinfo.cpp
index abbd7ad..1dfbbd1 100644
--- a/sendlateragent/sendlaterinfo.cpp
+++ b/sendlateragent/sendlaterinfo.cpp
@@ -91,16 +91,17 @@ Akonadi::Item::Id SendLaterInfo::itemId() const
 
 void SendLaterInfo::setDateTime(const QDateTime &time)
 {
-    mTime = time;
+    mDateTime = time;
 }
 
 QDateTime SendLaterInfo::dateTime() const
 {
-    return mTime;
+    return mDateTime;
 }
 
 void SendLaterInfo::readConfig(const KConfigGroup& config)
 {
+    mDateTime = config.readEntry("date", QDateTime());
     mRecursive = config.readEntry("recursive", false);
     mRecursiveEachValue = config.readEntry("recursiveValue",1);
     mRecursiveUnit = static_cast<RecursiveUnit>(config.readEntry("recursiveUnit", \
(int)None)); @@ -109,6 +110,7 @@ void SendLaterInfo::readConfig(const KConfigGroup& \
config)  
 void SendLaterInfo::writeConfig(KConfigGroup & config )
 {
+    config.writeEntry("date", mDateTime);
     config.writeEntry("recursive", mRecursive);
     config.writeEntry("recursiveValue", mRecursiveEachValue );
     config.writeEntry("recursiveUnit", (int)mRecursiveUnit);
diff --git a/sendlateragent/sendlaterinfo.h b/sendlateragent/sendlaterinfo.h
index 726d6cd..f403213 100644
--- a/sendlateragent/sendlaterinfo.h
+++ b/sendlateragent/sendlaterinfo.h
@@ -58,7 +58,7 @@ public:
 
 
 private:
-    QDateTime mTime;
+    QDateTime mDateTime;
     Akonadi::Item::Id mId;
     int mRecursiveEachValue;
     RecursiveUnit mRecursiveUnit;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic