23 #include "knotes/apps/knotes_options.h"
24 #include "knotes/utils/knoteutils.h"
26 #include "knotes/knotesglobalconfig.h"
27 #include <KCalUtils/ICalDrag>
28 #include <KCalUtils/VCalDrag>
29 #include <KCalCore/FileStorage>
32 #include "kdepim-version.h"
36 using namespace KCalUtils;
37 using namespace KCalCore;
39 #include <KABC/VCardDrag>
41 #include <KontactInterface/Core>
44 #include <KCmdLineArgs>
46 #include <KActionCollection>
49 #include <KLocalizedString>
50 #include <KMessageBox>
51 #include <KSystemTimeZones>
52 #include <KTemporaryFile>
54 #include <QDBusConnection>
55 #include <QDBusMessage>
61 : KontactInterface::Plugin( core, core, "knotes" ),
64 KNoteUtils::migrateToAkonadi();
65 setComponentData( KontactPluginFactory::componentData() );
69 i18nc(
"@action:inmenu",
"New Popup Note..." ),
this );
70 actionCollection()->addAction(
QLatin1String(
"new_note"), action );
71 connect( action, SIGNAL(triggered(
bool)), SLOT(slotNewNote()) );
72 action->setShortcut(
QKeySequence( Qt::CTRL + Qt::SHIFT + Qt::Key_N ) );
74 i18nc(
"@info:status",
"Create new popup note" ) );
76 i18nc(
"@info:whatsthis",
77 "You will be presented with a dialog where you can create a new popup note." ) );
78 insertNewAction( action );
80 mUniqueAppWatcher =
new KontactInterface::UniqueAppWatcher(
81 new KontactInterface::UniqueAppHandlerFactory<KNotesUniqueAppHandler>(),
this );
91 return mUniqueAppWatcher->isRunningStandalone();
116 new KAboutData(
"knotes", 0,
117 ki18nc(
"@title",
"KNotes" ),
119 ki18nc(
"@title",
"Popup Notes" ),
120 KAboutData::License_GPL_V2,
121 ki18nc(
"@info:credit",
"Copyright © 2003–2014 Kontact authors" ) );
123 mAboutData->addAuthor( ki18nc(
"@info:credit",
"Laurent Montel" ),
124 ki18nc(
"@info:credit",
"Current Maintainer" ),
127 mAboutData->addAuthor( ki18nc(
"@info:credit",
"Michael Brade" ),
128 ki18nc(
"@info:credit",
"Previous Maintainer" ),
130 mAboutData->addAuthor( ki18nc(
"@info:credit",
"Tobias Koenig" ),
131 ki18nc(
"@info:credit",
"Developer" ),
152 KABC::Addressee::List contacts;
156 KABC::Addressee::List::ConstIterator it;
159 KABC::Addressee::List::ConstIterator end(contacts.constEnd());
160 for ( it = contacts.constBegin(); it != end; ++it ) {
161 const QString email = (*it).fullEmail();
165 attendees.
append( email );
175 KCalCore::MemoryCalendar::Ptr cal(
new KCalCore::MemoryCalendar( KSystemTimeZones::local() ) );
177 KCalCore::Incidence::List incidences = cal->incidences();
178 Q_ASSERT( incidences.count() );
179 if ( !incidences.isEmpty() ) {
181 KCalCore::Incidence::Ptr i = incidences.first();
183 if ( i->type() == KCalCore::Incidence::TypeJournal ) {
184 summary = i18nc(
"@item",
"Note: %1", i->summary() );
186 summary = i->summary();
189 newNote( i18nc(
"@item",
"Note: %1", summary ), i->description() );
196 i18nc(
"@item",
"New Note" ), md->
text() );
203 if ( mails.
count() != 1 ) {
206 i18nc(
"@info",
"Dropping multiple mails is not supported." ) );
209 const QString txt = i18nc(
"@item",
"From: %1\nTo: %2\nSubject: %3",
212 i18nc(
"@item",
"Mail: %1", mail.
subject() ), txt );
223 static_cast<KNotesPart *
>( part() )->updateClickMessage();
229 void KNotesPlugin::slotNewNote()
232 static_cast<KNotesPart *
>( part() )->newNote();
233 core()->selectPlugin(
this );
239 KCmdLineArgs::addCmdLineOptions( knotesOptions() );
246 (void)plugin()->part();
247 return KontactInterface::UniqueAppHandler::newInstance();
const KAboutData * aboutData() const
virtual KontactInterface::Summary * createSummaryWidget(QWidget *parentWidget)
QString join(const QString &separator) const
virtual int newInstance()
int count(const T &value) const
static MailList fromMimeData(const QMimeData *md)
void append(const T &value)
bool isRunningStandalone() const
void processDropEvent(QDropEvent *)
bool canDecodeMimeData(const QMimeData *data) const
static bool canDecode(const QMimeData *md)
KParts::ReadOnlyPart * createPart()
QString fromLatin1(const char *str, int size)
virtual void loadCommandLineOptions()
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const