summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmanoil Kotsev <deloptes@gmail.com>2018-10-08 22:25:04 +0200
committerEmanoil Kotsev <deloptes@gmail.com>2020-02-23 17:06:49 +0100
commit371e3a43d00baf9b686f2555ed4f9ce688575c7a (patch)
tree6c39d445049847f2614181ddc1b8c9b142efdf90
parent804eb53c4112e0f2415aca2ebcdc89144eae744d (diff)
downloadtdepim-feat/knotes_interface_extention.tar.gz
tdepim-feat/knotes_interface_extention.zip
related to bug 2691. extend the interface of KNotesfeat/knotes_interface_extention
Signed-off-by: Emanoil Kotsev <deloptes@gmail.com>
-rw-r--r--knotes/KNotesAppIface.h7
-rw-r--r--knotes/KNotesIface.h7
-rw-r--r--knotes/knote.cpp6
-rw-r--r--knotes/knote.h6
-rw-r--r--knotes/knotesapp.cpp11
-rw-r--r--knotes/knotesapp.h6
-rw-r--r--knotes/resourcemanager.cpp2
-rw-r--r--kontact/plugins/knotes/knotes_part.cpp10
-rw-r--r--kontact/plugins/knotes/knotes_part.h2
-rw-r--r--kontact/plugins/knotes/knotes_plugin.cpp5
10 files changed, 60 insertions, 2 deletions
diff --git a/knotes/KNotesAppIface.h b/knotes/KNotesAppIface.h
index ad24a58b..80e38b25 100644
--- a/knotes/KNotesAppIface.h
+++ b/knotes/KNotesAppIface.h
@@ -34,6 +34,7 @@
#include <tqstring.h>
#include <tqmap.h>
+#include <tqdatetime.h>
#include <dcopobject.h>
@@ -210,6 +211,12 @@ k_dcop:
* new as well!) and false if the note is not modified or doesn't exist
*/
virtual bool isModified( const TQString& app, const TQString& noteId ) const = 0;
+
+ /**
+ * Get the last modified time of a note
+ * @return the last modified as a TQDateTime
+ */
+ virtual TQDateTime getLastModified( const TQString& noteId ) const = 0;
};
#endif
diff --git a/knotes/KNotesIface.h b/knotes/KNotesIface.h
index 1fba1860..2a8e8140 100644
--- a/knotes/KNotesIface.h
+++ b/knotes/KNotesIface.h
@@ -24,6 +24,7 @@
#include <tqstring.h>
#include <tqmap.h>
+#include <tqdatetime.h>
#include <dcopobject.h>
@@ -98,6 +99,12 @@ k_dcop:
* @return the body as a TQString
*/
virtual TQString text( const TQString& noteId ) const = 0;
+
+ /**
+ * Get the last modified time of a note
+ * @return the last modified as a TQDateTime
+ */
+ virtual TQDateTime getLastModified( const TQString& noteId ) const = 0;
};
#endif
diff --git a/knotes/knote.cpp b/knotes/knote.cpp
index 4f70848b..7f70ee17 100644
--- a/knotes/knote.cpp
+++ b/knotes/knote.cpp
@@ -453,6 +453,11 @@ TQString KNote::noteId() const
return m_journal->uid();
}
+TQDateTime KNote::getLastModified() const
+{
+ return m_journal->lastModified();
+}
+
TQString KNote::name() const
{
return m_label->text();
@@ -495,6 +500,7 @@ void KNote::setName( const TQString& name )
void KNote::setText( const TQString& text )
{
m_editor->setText( text );
+
saveData();
}
diff --git a/knotes/knote.h b/knotes/knote.h
index 43444b99..16ad552d 100644
--- a/knotes/knote.h
+++ b/knotes/knote.h
@@ -63,6 +63,12 @@ public:
TQString noteId() const;
+ /**
+ * Get the last modification date of a note
+ * @return the last modification date as a TQDateTime
+ */
+ TQDateTime getLastModified() const;
+
TQString name() const;
TQString text() const;
TQString plainText() const;
diff --git a/knotes/knotesapp.cpp b/knotes/knotesapp.cpp
index 5cc2635c..4390af66 100644
--- a/knotes/knotesapp.cpp
+++ b/knotes/knotesapp.cpp
@@ -342,6 +342,17 @@ TQMap<TQString,TQString> KNotesApp::notes() const
return notes;
}
+TQDateTime KNotesApp::getLastModified( const TQString& id ) const
+{
+ KNote* note = m_noteList[id];
+ TQDateTime d;
+ if ( note )
+ d = note->getLastModified();
+ if (!d.isValid())
+ d.setTime_t(0);
+ return d;
+}
+
TQString KNotesApp::name( const TQString& id ) const
{
KNote* note = m_noteList[id];
diff --git a/knotes/knotesapp.h b/knotes/knotesapp.h
index 0888e20b..8f8665a0 100644
--- a/knotes/knotesapp.h
+++ b/knotes/knotesapp.h
@@ -81,6 +81,12 @@ public:
TQMap<TQString,TQString> notes() const;
+ /**
+ * Get the last modified time of a note
+ * @return the last modified as a TQDateTime
+ */
+ TQDateTime getLastModified( const TQString& noteId ) const;
+
int width( const TQString& noteId ) const;
int height( const TQString& noteId ) const;
diff --git a/knotes/resourcemanager.cpp b/knotes/resourcemanager.cpp
index 4ede5b82..1823bf52 100644
--- a/knotes/resourcemanager.cpp
+++ b/knotes/resourcemanager.cpp
@@ -104,8 +104,10 @@ void KNotesResourceManager::registerNote( ResourceNotes *resource,
KCal::Journal *journal )
{
// TODO: only emit the signal if the journal is new?
+ TQDateTime dt = journal->lastModified();
m_resourceMap.insert( journal->uid(), resource );
emit sigRegisteredNote( journal );
+ journal->setLastModified(dt);
}
void KNotesResourceManager::deleteNote( KCal::Journal *journal )
diff --git a/kontact/plugins/knotes/knotes_part.cpp b/kontact/plugins/knotes/knotes_part.cpp
index 02a4028e..b04ec70f 100644
--- a/kontact/plugins/knotes/knotes_part.cpp
+++ b/kontact/plugins/knotes/knotes_part.cpp
@@ -274,6 +274,16 @@ TQMap<TQString, TQString> KNotesPart::notes() const
return notes;
}
+TQDateTime KNotesPart::getLastModified( const TQString& id ) const
+{
+ KNotesIconViewItem *note = mNoteList[ id ];
+ TQDateTime dt;
+ if ( note )
+ dt = note->journal()->lastModified();
+ if (!dt.isValid())
+ dt.setTime_t(0); //else return invalid date
+ return dt;
+}
// private stuff
diff --git a/kontact/plugins/knotes/knotes_part.h b/kontact/plugins/knotes/knotes_part.h
index 023a78b9..67808bae 100644
--- a/kontact/plugins/knotes/knotes_part.h
+++ b/kontact/plugins/knotes/knotes_part.h
@@ -72,6 +72,8 @@ class KNotesPart : public KParts::ReadOnlyPart, virtual public KNotesIface
TQMap<TQString, TQString> notes() const;
+ TQDateTime getLastModified( const TQString& id ) const;
+
private slots:
void createNote( KCal::Journal *journal );
void killNote( KCal::Journal *journal );
diff --git a/kontact/plugins/knotes/knotes_plugin.cpp b/kontact/plugins/knotes/knotes_plugin.cpp
index fceeb65b..bec6fb5c 100644
--- a/kontact/plugins/knotes/knotes_plugin.cpp
+++ b/kontact/plugins/knotes/knotes_plugin.cpp
@@ -70,9 +70,10 @@ const TDEAboutData *KNotesPlugin::aboutData()
mAboutData = new TDEAboutData( "knotes", I18N_NOOP( "Notes Management" ),
"0.5", I18N_NOOP( "Notes Management" ),
TDEAboutData::License_GPL_V2,
- "(c) 2003-2004 The Kontact developers" );
- mAboutData->addAuthor( "Michael Brade", "Current Maintainer", "brade@kde.org" );
+ "(c) 2003-2020 The Kontact developers" );
+ mAboutData->addAuthor( "Michael Brade", "", "brade@kde.org" );
mAboutData->addAuthor( "Tobias Koenig", "", "tokoe@kde.org" );
+ mAboutData->addAuthor( "TDE Team", "", "trinitydesktop.org" );
}
return mAboutData;