25 #include "notesharedglobalconfig.h"
26 #include "noteshared/noteutils.h"
28 #include "knotesadaptor.h"
29 #include "noteshared/job/createnewnotejob.h"
33 #include "knotes/configdialog/knoteconfigdialog.h"
34 #include "knotes/print/knoteprinter.h"
35 #include "knotes/print/knoteprintobject.h"
36 #include "knotes/print/knoteprintselectthemedialog.h"
37 #include "knotes/knoteedit.h"
38 #include "knotes/knotesglobalconfig.h"
39 #include "knotes/configdialog/knotesimpleconfigdialog.h"
40 #include "knotes/finddialog/knotefinddialog.h"
41 #include "utils/knoteutils.h"
42 #include "alarms/notealarmdialog.h"
43 #include "noteshared/resources/localresourcecreator.h"
44 #include "noteshared/job/createnewnotejob.h"
46 #include "noteshared/akonadi/notesakonaditreemodel.h"
47 #include "noteshared/akonadi/noteschangerecorder.h"
48 #include "noteshared/attributes/notealarmattribute.h"
49 #include "noteshared/attributes/showfoldernotesattribute.h"
50 #include "noteshared/attributes/notealarmattribute.h"
51 #include "noteshared/attributes/notedisplayattribute.h"
52 #include "noteshared/attributes/notelockattribute.h"
54 #include <Akonadi/Notes/NoteUtils>
56 #include <Akonadi/Session>
57 #include <Akonadi/ChangeRecorder>
58 #include <Akonadi/ETMViewStateSaver>
59 #include <Akonadi/EntityDisplayAttribute>
60 #include <Akonadi/ItemCreateJob>
61 #include <Akonadi/ItemFetchJob>
62 #include <KCheckableProxyModel>
63 #include <akonadi/itemdeletejob.h>
64 #include <Akonadi/ItemFetchScope>
67 #include <KMime/KMimeMessage>
69 #include <Akonadi/ItemModifyJob>
70 #include <Akonadi/Control>
72 #include <KActionCollection>
74 #include <KInputDialog>
75 #include <KMessageBox>
76 #include <KXMLGUIFactory>
77 #include <KPrintPreview>
78 #include <ksocketfactory.h>
79 #include <KApplication>
80 #include <KFileDialog>
81 #include <KToggleAction>
83 #include <QApplication>
89 #include <dnssd/publicservice.h>
92 : KParts::ReadOnlyPart( parent ),
98 (void)
new KNotesAdaptor(
this );
101 setComponentData( KComponentData(
"knotes" ) );
103 Akonadi::Control::widgetNeedsAkonadi(widget());
105 KNoteUtils::migrateToAkonadi();
107 if (KNotesGlobalConfig::self()->autoCreateResourceOnStart()) {
108 NoteShared::LocalResourceCreator *creator =
new NoteShared::LocalResourceCreator(
this );
109 creator->createIfMissing();
114 i18nc(
"@action:inmenu create new popup note",
"&New" ),
this );
115 actionCollection()->addAction(
QLatin1String(
"file_new"), mNewNote );
116 connect( mNewNote, SIGNAL(triggered(
bool)), SLOT(
newNote()) );
117 mNewNote->setShortcut(
QKeySequence( Qt::CTRL + Qt::Key_N ) );
118 mNewNote->setHelpText(
119 i18nc(
"@info:status",
"Create a new popup note" ) );
120 mNewNote->setWhatsThis(
121 i18nc(
"@info:whatsthis",
122 "You will be presented with a dialog where you can add a new popup note." ) );
124 mNoteEdit =
new KAction( KIcon(
QLatin1String(
"document-edit") ),
125 i18nc(
"@action:inmenu",
"Edit..." ),
this );
126 actionCollection()->addAction(
QLatin1String(
"edit_note"), mNoteEdit );
127 connect( mNoteEdit, SIGNAL(triggered(
bool)), SLOT(
editNote()) );
128 mNoteEdit->setHelpText(
129 i18nc(
"@info:status",
"Edit popup note" ) );
130 mNoteEdit->setWhatsThis(
131 i18nc(
"@info:whatsthis",
132 "You will be presented with a dialog where you can modify an existing popup note." ) );
134 mNoteRename =
new KAction( KIcon(
QLatin1String(
"edit-rename") ),
135 i18nc(
"@action:inmenu",
"Rename..." ),
this );
137 actionCollection()->addAction(
QLatin1String(
"edit_rename"), mNoteRename );
138 connect( mNoteRename, SIGNAL(triggered(
bool)), SLOT(renameNote()) );
139 mNoteRename->setHelpText(
140 i18nc(
"@info:status",
"Rename popup note" ) );
141 mNoteRename->setWhatsThis(
142 i18nc(
"@info:whatsthis",
143 "You will be presented with a dialog where you can rename an existing popup note." ) );
145 mNoteDelete =
new KAction( KIcon(
QLatin1String(
"edit-delete") ),
146 i18nc(
"@action:inmenu",
"Delete" ),
this );
147 actionCollection()->addAction(
QLatin1String(
"edit_delete"), mNoteDelete );
148 connect( mNoteDelete, SIGNAL(triggered(
bool)), SLOT(killSelectedNotes()) );
149 mNoteDelete->setShortcut(
QKeySequence( Qt::Key_Delete ) );
150 mNoteDelete->setHelpText(
151 i18nc(
"@info:status",
"Delete popup note" ) );
152 mNoteDelete->setWhatsThis(
153 i18nc(
"@info:whatsthis",
154 "You will be prompted if you really want to permanently remove "
155 "the selected popup note." ) );
157 mNotePrint =
new KAction( KIcon(
QLatin1String(
"document-print") ),
158 i18nc(
"@action:inmenu",
"Print Selected Notes..." ),
this );
159 actionCollection()->addAction(
QLatin1String(
"print_note"), mNotePrint );
160 connect( mNotePrint, SIGNAL(triggered(
bool)), SLOT(slotPrintSelectedNotes()) );
161 mNotePrint->setHelpText(
162 i18nc(
"@info:status",
"Print popup note" ) );
163 mNotePrint->setWhatsThis(
164 i18nc(
"@info:whatsthis",
165 "You will be prompted to print the selected popup note." ) );
167 if(KPrintPreview::isAvailable()) {
168 mNotePrintPreview =
new KAction( KIcon(
QLatin1String(
"document-print-preview") ),i18nc(
"@action:inmenu",
"Print Preview Selected Notes..." ),
this );
169 actionCollection()->addAction(
QLatin1String(
"print_preview_note"), mNotePrintPreview );
171 connect( mNotePrintPreview, SIGNAL(triggered(
bool)), SLOT(slotPrintPreviewSelectedNotes()) );
174 mNoteConfigure =
new KAction( KIcon(
QLatin1String(
"configure") ), i18n(
"Note settings..." ),
this );
175 actionCollection()->addAction(
QLatin1String(
"configure_note"), mNoteConfigure );
176 connect( mNoteConfigure, SIGNAL(triggered(
bool)), SLOT(slotNotePreferences()) );
178 KAction *act =
new KAction( KIcon(
QLatin1String(
"configure") ), i18n(
"Preferences KNotes..." ),
this );
179 actionCollection()->addAction(
QLatin1String(
"knotes_configure"), act );
180 connect( act, SIGNAL(triggered(
bool)), SLOT(slotPreferences()) );
182 mNoteSendMail =
new KAction( KIcon(
QLatin1String(
"mail-send") ), i18n(
"Mail..." ),
this );
183 actionCollection()->addAction(
QLatin1String(
"mail_note"), mNoteSendMail );
184 connect( mNoteSendMail, SIGNAL(triggered(
bool)), SLOT(slotMail()) );
186 mNoteSendNetwork =
new KAction( KIcon(
QLatin1String(
"network-wired") ), i18n(
"Send..." ),
this );
187 actionCollection()->addAction(
QLatin1String(
"send_note"), mNoteSendNetwork );
188 connect( mNoteSendNetwork, SIGNAL(triggered(
bool)), SLOT(slotSendToNetwork()) );
190 mNoteSetAlarm =
new KAction( KIcon(
QLatin1String(
"knotes_alarm") ), i18n(
"Set Alarm..." ),
this );
191 actionCollection()->addAction(
QLatin1String(
"set_alarm"), mNoteSetAlarm );
192 connect( mNoteSetAlarm, SIGNAL(triggered(
bool)), SLOT(slotSetAlarm()) );
195 i18n(
"New Note From Clipboard" ),
this );
196 actionCollection()->addAction(
QLatin1String(
"new_note_clipboard"), act );
197 connect( act, SIGNAL(triggered()), SLOT(slotNewNoteFromClipboard()) );
201 i18n(
"New Note From Text File..." ),
this );
202 actionCollection()->addAction(
QLatin1String(
"new_note_from_text_file"), act );
203 connect( act, SIGNAL(triggered()), SLOT(slotNewNoteFromTextFile()) );
205 mSaveAs =
new KAction( KIcon(
QLatin1String(
"document-save-as") ), i18n(
"Save As..." ),
this );
206 actionCollection()->addAction(
QLatin1String(
"save_note"), mSaveAs );
207 connect( mSaveAs, SIGNAL(triggered(
bool)), SLOT(slotSaveAs()) );
209 mReadOnly =
new KToggleAction( KIcon(
QLatin1String(
"object-locked") ), i18n(
"Lock" ),
this );
210 actionCollection()->addAction(
QLatin1String(
"lock_note"), mReadOnly );
211 connect( mReadOnly, SIGNAL(triggered(
bool)), SLOT(slotUpdateReadOnly()) );
212 mReadOnly->setCheckedState( KGuiItem( i18n(
"Unlock" ),
QLatin1String(
"object-unlocked") ) );
215 KStandardAction::find(
this, SLOT(slotOpenFindDialog()), actionCollection());
217 Akonadi::Session *session =
new Akonadi::Session(
"KNotes Session",
this );
218 mNoteRecorder =
new NoteShared::NotesChangeRecorder(
this);
219 mNoteRecorder->changeRecorder()->setSession(session);
220 mNoteTreeModel =
new NoteShared::NotesAkonadiTreeModel(mNoteRecorder->changeRecorder(),
this);
222 connect( mNoteTreeModel, SIGNAL(rowsInserted(
QModelIndex,
int,
int)),
226 connect( mNoteRecorder->changeRecorder(), SIGNAL(itemRemoved(Akonadi::Item)), SLOT(slotItemRemoved(Akonadi::Item)) );
227 connect( mNoteRecorder->changeRecorder(), SIGNAL(collectionChanged(Akonadi::Collection,
QSet<QByteArray>)), SLOT(slotCollectionChanged(Akonadi::Collection,
QSet<QByteArray>)) );
231 mModelProxy =
new KCheckableProxyModel(
this );
232 mModelProxy->setSelectionModel( mSelectionModel );
233 mModelProxy->setSourceModel( mNoteTreeModel );
235 KSharedConfigPtr _config = KSharedConfig::openConfig(
QLatin1String(
"kcmknotessummaryrc") );
238 new KViewStateMaintainer<Akonadi::ETMViewStateSaver>( _config->group(
"CheckState" ), this );
239 mModelState->setSelectionModel( mSelectionModel );
243 mQuickSearchAction =
new KAction( i18n(
"Set Focus to Quick Search"),
this );
245 mQuickSearchAction->setShortcut(
QKeySequence( Qt::ALT + Qt::Key_Q ) );
246 actionCollection()->addAction(
QLatin1String(
"focus_to_quickseach"), mQuickSearchAction );
247 connect( mQuickSearchAction, SIGNAL(triggered(
bool)), mNotesWidget, SLOT(slotFocusQuickSearch()) );
252 connect( mNotesWidget->
notesView(), SIGNAL(itemSelectionChanged()),
253 this, SLOT(slotOnCurrentChanged()) );
254 slotOnCurrentChanged();
256 setWidget( mNotesWidget );
258 updateNetworkListener();
273 void KNotesPart::slotItemRemoved(
const Akonadi::Item &item)
279 void KNotesPart::slotRowInserted(
const QModelIndex &parent,
int start,
int end)
281 for (
int i = start; i <= end; ++i) {
282 if ( mNoteTreeModel->hasIndex( i, 0, parent ) ) {
283 const QModelIndex child = mNoteTreeModel->index( i, 0, parent );
284 Akonadi::Collection parentCollection = mNoteTreeModel->data( child, Akonadi::EntityTreeModel::ParentCollectionRole).value<Akonadi::Collection>();
285 if (parentCollection.hasAttribute<NoteShared::ShowFolderNotesAttribute>()) {
287 mNoteTreeModel->data( child, Akonadi::EntityTreeModel::ItemRole ).value<Akonadi::Item>();
288 if ( !item.hasPayload<KMime::Message::Ptr>() )
300 while ( i.hasNext() ) {
307 void KNotesPart::slotPrintPreviewSelectedNotes()
309 printSelectedNotes(
true);
312 void KNotesPart::slotPrintSelectedNotes()
314 printSelectedNotes(
false);
317 void KNotesPart::printSelectedNotes(
bool preview)
321 KMessageBox::information(
324 "To print notes, first select the notes to print from the list." ),
325 i18nc(
"@title:window",
"Print Popup Notes" ) );
328 KNotesGlobalConfig *globalConfig = KNotesGlobalConfig::self();
329 QString printingTheme = globalConfig->theme();
333 printingTheme = dlg->selectedTheme();
337 if (!printingTheme.
isEmpty()) {
340 listPrintObj.
append(
new KNotePrintObject(static_cast<KNotesIconViewItem *>( item )->item()));
342 KNotePrinter printer;
343 printer.printNotes( listPrintObj, printingTheme, preview );
344 qDeleteAll(listPrintObj);
357 NoteShared::CreateNewNoteJob *job =
new NoteShared::CreateNewNoteJob(
this, widget());
358 job->setRichText(KNotesGlobalConfig::self()->richText());
359 job->setNote(name, text);
363 void KNotesPart::slotNoteCreationFinished(
KJob* job)
366 kWarning() << job->errorString();
367 NoteShared::NoteSharedGlobalConfig::self()->setDefaultFolder(-1);
368 NoteShared::NoteSharedGlobalConfig::self()->writeConfig();
369 KMessageBox::error(widget(), i18n(
"Note was not created."), i18n(
"Create new note"));
389 ( (!force && KMessageBox::warningContinueCancelList(
391 i18nc(
"@info",
"Do you really want to delete this note?" ),
393 i18nc(
"@title:window",
"Confirm Delete" ),
394 KStandardGuiItem::del() ) == KMessageBox::Continue )
397 Akonadi::ItemDeleteJob *job =
new Akonadi::ItemDeleteJob(note->
item());
398 connect(job, SIGNAL(result(
KJob*)), SLOT(slotDeleteNotesFinished(
KJob*)) );
443 while ( i.hasNext() ) {
452 void KNotesPart::killSelectedNotes()
469 Akonadi::Item::List lst;
471 while ( kniviIt.hasNext() ) {
474 lst.append(iconViewIcon->
item());
477 if (!lst.isEmpty()) {
478 Akonadi::ItemDeleteJob *job =
new Akonadi::ItemDeleteJob(lst);
479 connect(job, SIGNAL(result(
KJob*)), SLOT(slotDeleteNotesFinished(
KJob*)) );
485 void KNotesPart::slotDeleteNotesFinished(
KJob* job)
487 if ( job->error() ) {
488 qDebug()<<
" problem during delete job note:"<<job->errorString();
497 if ( mNotesWidget->
notesView()->itemAt ( pos ) ) {
499 const bool uniqueNoteSelected = (mNotesWidget->
notesView()->selectedItems().count() == 1);
500 const bool readOnly = uniqueNoteSelected ?
static_cast<KNotesIconViewItem *
>(mNotesWidget->
notesView()->selectedItems().at(0))->readOnly() :
false;
501 if (uniqueNoteSelected) {
516 contextMenu->
addAction(mNoteSendNetwork);
520 if (KPrintPreview::isAvailable()) {
521 contextMenu->
addAction(mNotePrintPreview);
534 contextMenu->
exec( mNotesWidget->
notesView()->mapFromParent( globalPos ) );
542 mNotesWidget->
notesView()->setCurrentItem(knoteItem);
551 dlg->setTitle( knotesItem->
realName() );
555 dlg->setAcceptRichText(knotesItem->
isRichText());
556 dlg->setTabSize(knotesItem->
tabSize());
557 dlg->setAutoIndentMode(knotesItem->
autoIndent());
558 dlg->setTextFont(knotesItem->
textFont());
562 dlg->noteEdit()->setFocus();
563 if ( dlg->exec() == QDialog::Accepted ) {
577 void KNotesPart::renameNote()
584 KInputDialog::getText( i18nc(
"@title:window",
"Rename Popup Note" ),
585 i18nc(
"@label:textbox",
"New Name:" ),
586 oldName, &ok, mNotesWidget );
587 if ( ok && ( newName != oldName ) ) {
592 void KNotesPart::slotOnCurrentChanged( )
594 const bool uniqueNoteSelected = (mNotesWidget->
notesView()->selectedItems().count() == 1);
595 const bool enabled(mNotesWidget->
notesView()->currentItem());
596 mNoteRename->setEnabled( enabled && uniqueNoteSelected);
597 mNoteEdit->setEnabled( enabled && uniqueNoteSelected);
598 mNoteConfigure->setEnabled( uniqueNoteSelected );
599 mNoteSendMail->setEnabled(uniqueNoteSelected);
600 mNoteSendNetwork->setEnabled(uniqueNoteSelected);
601 mNoteSetAlarm->setEnabled(uniqueNoteSelected);
602 mSaveAs->setEnabled(uniqueNoteSelected);
603 mReadOnly->setEnabled(uniqueNoteSelected);
604 if (uniqueNoteSelected) {
606 mReadOnly->setChecked(readOnly);
607 mNoteEdit->setText(readOnly ? i18n(
"Show Note...") : i18nc(
"@action:inmenu",
"Edit..." ));
609 mNoteEdit->setText(i18nc(
"@action:inmenu",
"Edit..." ));
613 void KNotesPart::slotNotePreferences()
615 if (!mNotesWidget->
notesView()->currentItem())
619 Akonadi::Item item = knoteItem->
item();
621 if (dialog->exec() ) {
622 KNoteUtils::updateConfiguration();
624 dialog->save(item, isRichText);
625 KMime::Message::Ptr message = item.payload<KMime::Message::Ptr>();
626 message->contentType(
true )->setMimeType( isRichText ?
"text/html" :
"text/plain" );
628 Akonadi::ItemModifyJob *job =
new Akonadi::ItemModifyJob(item);
629 connect( job, SIGNAL(result(
KJob*)), SLOT(slotNoteSaved(
KJob*)) );
634 void KNotesPart::slotPreferences()
637 KNoteConfigDialog *dialog =
new KNoteConfigDialog( i18n(
"Settings" ), widget());
638 connect( dialog, SIGNAL(configCommitted()),
this, SLOT(slotConfigUpdated()));
644 updateNetworkListener();
647 void KNotesPart::slotConfigUpdated()
649 updateNetworkListener();
652 void KNotesPart::slotMail()
654 if (!mNotesWidget->
notesView()->currentItem())
657 NoteShared::NoteUtils noteUtils;
661 void KNotesPart::slotSendToNetwork()
663 if (!mNotesWidget->
notesView()->currentItem())
666 NoteShared::NoteUtils noteUtils;
670 void KNotesPart::updateNetworkListener()
675 if ( NoteShared::NoteSharedGlobalConfig::receiveNotes() ) {
677 mPublisher=
new DNSSD::PublicService(NoteShared::NoteSharedGlobalConfig::senderID(),
QLatin1String(
"_knotes._tcp"), NoteShared::NoteSharedGlobalConfig::port());
678 mPublisher->publishAsync();
682 void KNotesPart::slotSetAlarm()
684 if (!mNotesWidget->
notesView()->currentItem())
688 Akonadi::Item item = knoteItem->
item();
689 if (item.hasAttribute<NoteShared::NoteAlarmAttribute>()) {
690 dlg->setAlarm(item.attribute<NoteShared::NoteAlarmAttribute>()->dateTime());
693 bool needToModify =
true;
694 KDateTime dateTime = dlg->alarm();
695 if (dateTime.isValid()) {
696 NoteShared::NoteAlarmAttribute *attribute = item.attribute<NoteShared::NoteAlarmAttribute>( Akonadi::Entity::AddIfMissing );
697 attribute->setDateTime(dateTime);
699 if (item.hasAttribute<NoteShared::NoteAlarmAttribute>()) {
700 item.removeAttribute<NoteShared::NoteAlarmAttribute>();
702 needToModify =
false;
706 Akonadi::ItemModifyJob *job =
new Akonadi::ItemModifyJob(item);
707 connect( job, SIGNAL(result(
KJob*)), SLOT(slotNoteSaved(
KJob*)) );
713 void KNotesPart::slotNoteSaved(
KJob *job)
715 qDebug()<<
" void KNote::slotNoteSaved(KJob *job)";
716 if ( job->error() ) {
717 qDebug()<<
" problem during save note:"<<job->errorString();
721 void KNotesPart::slotNewNoteFromClipboard()
723 const QString &
text = KApplication::clipboard()->text();
727 void KNotesPart::slotSaveAs()
729 if (!mNotesWidget->
notesView()->currentItem())
738 convert->
setText( i18n(
"Save note as plain text" ) );
741 dlg->setOperationMode( KFileDialog::Saving );
742 dlg->setCaption( i18n(
"Save As" ) );
748 const QString fileName = dlg->selectedFile();
749 const bool htmlFormatAndSaveAsHtml = (convert && !convert->
isChecked());
755 QFile file( fileName );
756 if ( file.exists() &&
757 KMessageBox::warningContinueCancel( widget(),
758 i18n(
"<qt>A file named <b>%1</b> already exists.<br />"
759 "Are you sure you want to overwrite it?</qt>",
760 QFileInfo( file ).fileName() ) ) != KMessageBox::Continue ) {
764 if ( file.open( QIODevice::WriteOnly ) ) {
768 if ( htmlFormatAndSaveAsHtml ) {
779 void KNotesPart::slotUpdateReadOnly()
786 const bool readOnly = mReadOnly->isChecked();
788 mNoteEdit->setText(readOnly ? i18n(
"Show Note...") : i18nc(
"@action:inmenu",
"Edit..." ));
800 void KNotesPart::slotOpenFindDialog()
802 if (!mNoteFindDialog) {
803 mNoteFindDialog =
new KNoteFindDialog(widget());
804 connect(mNoteFindDialog, SIGNAL(noteSelected(Akonadi::Item::Id)),
this, SLOT(slotSelectNote(Akonadi::Item::Id)));
808 while (i.hasNext()) {
810 lst.
insert(i.key(), i.value()->item());
812 mNoteFindDialog->setExistingNotes(lst);
813 mNoteFindDialog->show();
816 void KNotesPart::slotSelectNote(Akonadi::Item::Id
id)
821 void KNotesPart::slotCollectionChanged(
const Akonadi::Collection &col,
const QSet<QByteArray> & set)
823 if (set.
contains(
"showfoldernotesattribute")) {
825 if (col.hasAttribute<NoteShared::ShowFolderNotesAttribute>()) {
826 fetchNotesFromCollection(col);
829 while (i.hasNext()) {
831 Akonadi::Item item = i.value()->item();
832 if (item.parentCollection() == col) {
833 slotItemRemoved(item);
840 void KNotesPart::fetchNotesFromCollection(
const Akonadi::Collection &col)
842 Akonadi::ItemFetchJob *job =
new Akonadi::ItemFetchJob( col );
843 job->fetchScope().fetchFullPayload(
true);
844 job->fetchScope().fetchAttribute<NoteShared::NoteLockAttribute>();
845 job->fetchScope().fetchAttribute<NoteShared::NoteDisplayAttribute>();
846 job->fetchScope().fetchAttribute<NoteShared::NoteAlarmAttribute>();
847 job->fetchScope().setAncestorRetrieval(Akonadi::ItemFetchScope::Parent);
848 connect( job, SIGNAL(result(
KJob*)), SLOT(slotItemFetchFinished(
KJob*)) );
851 void KNotesPart::slotItemFetchFinished(
KJob *job)
853 if ( job->error() ) {
854 qDebug() <<
"Error occurred during item fetch:"<<job->errorString();
858 Akonadi::ItemFetchJob *fetchJob = qobject_cast<Akonadi::ItemFetchJob*>( job );
860 const Akonadi::Item::List items = fetchJob->items();
861 foreach (
const Akonadi::Item &item, items ) {
862 if ( !item.hasPayload<KMime::Message::Ptr>() )
868 void KNotesPart::slotNewNoteFromTextFile()
871 const QString filename = KFileDialog::getOpenFileName( KUrl(),
874 i18n(
"Select Text File") );
877 if (f.open(QIODevice::ReadOnly|QIODevice::Text)) {
880 KMessageBox::error(widget(), i18n(
"Error during open text file: %1", f.errorString()), i18n(
"Open Text File"));
883 newNote( i18n(
"Note from file '%1'",filename), text);
void addNote(const Akonadi::Item &item)
QMap< QString, QString > notes() const
iterator insert(const Key &key, const T &value)
int cursorPositionFromStart() const
void updateClickMessage()
void newNoteFromClipboard(const QString &name=QString())
virtual QByteArray text(quint32 serialNumber) const =0
QColor textForegroundColor() const
void editNote(Akonadi::Entity::Id id)
bool registerObject(const QString &path, QObject *object, QFlags< QDBusConnection::RegisterOption > options)
KNotesPart(QObject *parent=0)
QDBusConnection sessionBus()
QColor textBackgroundColor() const
QStringList notesList() const
void killNote(Akonadi::Item::Id id)
KNotesIconViewItem * iconView(Akonadi::Item::Id id) const
QString number(int n, int base)
void append(const T &value)
QString fromUtf8(const char *str, int size)
void newNote(const QString &name=QString(), const QString &text=QString())
void setChangeIconTextAndDescription(const QString &iconText, const QString &description, int position)
void setText(Akonadi::Item::Id id, const QString &newText)
QHash< Akonadi::Item::Id, KNotesIconViewItem * > noteList() const
void setName(Akonadi::Item::Id id, const QString &newName)
bool contains(const T &value) const
void setDescription(const QString &)
QString text(Mode mode) const
void set(quint32, const QString &, const QString &, const QString &, const QString &, time_t)
QString & replace(int position, int n, QChar after)
QString name(Akonadi::Item::Id id) const
QString toPlainText() const
void popupRMB(QListWidgetItem *item, const QPoint &pos, const QPoint &globalPos)
QString description() const
void setHtml(const QString &html)
void setIconText(const QString &text, bool save=true)
void setText(const QString &text)
iterator insert(const Key &key, const T &value)
void setChangeItem(const Akonadi::Item &item, const QSet< QByteArray > &set)
QString text(Akonadi::Entity::Id id) const
QString toHtml(const QByteArray &encoding) const
void setReadOnly(bool b, bool save=true)