• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

knotes

  • sources
  • kde-4.12
  • kdepim
  • knotes
  • notes
knote.cpp
Go to the documentation of this file.
1 /*******************************************************************
2  KNotes -- Notes for the KDE project
3 
4  Copyright (c) 1997-2007, The KNotes Developers
5 
6  This program is free software; you can redistribute it and/or
7  modify it under the terms of the GNU General Public License
8  as published by the Free Software Foundation; either version 2
9  of the License, or (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program; if not, write to the Free Software
18  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 *******************************************************************/
20 
21 #include "knote.h"
22 #include "alarms/knotealarmdialog.h"
23 #include "configdialog/knotesimpleconfigdialog.h"
24 #include "print/knoteprintselectthemedialog.h"
25 #include "knotebutton.h"
26 #include "knoteconfig.h"
27 #include "utils/knoteutils.h"
28 #include "configdialog/knoteconfigdialog.h"
29 #include "knoteedit.h"
30 #include "print/knoteprinter.h"
31 #include "print/knoteprintobject.h"
32 #include "knotesglobalconfig.h"
33 #include "kdepim-version.h"
34 
35 #include <kaction.h>
36 #include <kactioncollection.h>
37 #include <kapplication.h>
38 #include <kcal/journal.h>
39 #include <kcombobox.h>
40 #include <kfiledialog.h>
41 #include <kfind.h>
42 #include <kglobalsettings.h>
43 #include <kicon.h>
44 #include <kiconeffect.h>
45 #include <kiconloader.h>
46 #include <kinputdialog.h>
47 #include <kio/netaccess.h>
48 #include <klocale.h>
49 #include <kmenu.h>
50 #include <kmessagebox.h>
51 #include <kprocess.h>
52 #include <kselectaction.h>
53 #include <ksocketfactory.h>
54 #include <kstandardaction.h>
55 #include <kstandarddirs.h>
56 #include <ktoggleaction.h>
57 #include <ktoolbar.h>
58 #include <kwindowsystem.h>
59 #include <kxmlguibuilder.h>
60 #include <kxmlguifactory.h>
61 #include <netwm.h>
62 #include <KPrintPreview>
63 
64 #include <QBoxLayout>
65 #include <QCheckBox>
66 #include <QFile>
67 #include <QHBoxLayout>
68 #include <QLabel>
69 #include <QObject>
70 #include <QPixmap>
71 #include <QSize>
72 #include <QSizeGrip>
73 #include <QTextStream>
74 #include <QVBoxLayout>
75 #include <QDesktopWidget>
76 #include <QPointer>
77 #include <QFocusEvent>
78 
79 #ifdef Q_WS_X11
80 #include <fixx11h.h>
81 #include <QX11Info>
82 #endif
83 
84 using namespace KCal;
85 
86 
87 KNote::KNote( const QDomDocument& buildDoc, Journal *j, QWidget *parent )
88  : QFrame( parent, Qt::FramelessWindowHint ),
89  m_label( 0 ),
90  m_grip( 0 ),
91  m_button( 0 ),
92  m_tool( 0 ),
93  m_editor( 0 ),
94  m_config( 0 ),
95  m_journal( j ),
96  m_find( 0 ),
97  m_kwinConf( KSharedConfig::openConfig( QLatin1String("kwinrc") ) ),
98  m_blockEmitDataChanged( false ),
99  mBlockWriteConfigDuringCommitData( false )
100 {
101  setAcceptDrops( true );
102  setAttribute( Qt::WA_DeleteOnClose );
103  setDOMDocument( buildDoc );
104  setObjectName( m_journal->uid() );
105  setXMLFile( componentData().componentName() + QLatin1String("ui.rc"), false, false );
106 
107  // create the main layout
108  m_noteLayout = new QVBoxLayout( this );
109  m_noteLayout->setMargin( 0 );
110 
111  // if there is no title yet, use the start date if valid
112  // (KOrganizer's journals don't have titles but a valid start date)
113  if ( m_journal->summary().isNull() && m_journal->dtStart().isValid() ) {
114  const QString s = KGlobal::locale()->formatDateTime( m_journal->dtStart() );
115  m_journal->setSummary( s );
116  }
117 
118  createActions();
119 
120  QString configFile;
121  m_config = KNoteUtils::createConfig(m_journal, configFile);
122 
123  buildGui(configFile);
124 
125  prepare();
126 }
127 
128 KNote::~KNote()
129 {
130  delete m_config;
131 }
132 
133 void KNote::changeJournal(KCal::Journal *journal)
134 {
135  m_journal = journal;
136  m_editor->setText( m_journal->description() );
137  m_editor->document()->setModified( false );
138  m_label->setText( m_journal->summary() );
139  updateLabelAlignment();
140 
141 }
142 
143 // -------------------- public slots -------------------- //
144 
145 void KNote::slotKill( bool force )
146 {
147  m_blockEmitDataChanged = true;
148  if ( !force &&
149  ( KMessageBox::warningContinueCancel( this,
150  i18n( "<qt>Do you really want to delete note <b>%1</b>?</qt>",
151  m_label->text() ),
152  i18n( "Confirm Delete" ),
153  KGuiItem( i18n( "&Delete" ), QLatin1String("edit-delete") ),
154  KStandardGuiItem::cancel(),
155  QLatin1String("ConfirmDeleteNote") ) != KMessageBox::Continue ) ) {
156  m_blockEmitDataChanged = false;
157  return;
158  }
159  // delete the configuration first, then the corresponding file
160  delete m_config;
161  m_config = 0;
162  KNoteUtils::removeNote(m_journal, this);
163 
164  emit sigKillNote( m_journal );
165 }
166 
167 
168 // -------------------- public member functions -------------------- //
169 
170 void KNote::saveData(bool update )
171 {
172  m_journal->setSummary( m_label->text() );
173  m_journal->setDescription( m_editor->text() );
174  KNoteUtils::savePreferences( m_journal, m_config);
175 
176  if(update)
177  {
178  emit sigDataChanged(noteId());
179  m_editor->document()->setModified( false );
180  }
181 }
182 
183 void KNote::saveConfig() const
184 {
185  m_config->setWidth( width() );
186  m_config->setHeight( height() );
187  m_config->setPosition( pos() );
188 
189 #ifdef Q_WS_X11
190  NETWinInfo wm_client( QX11Info::display(), winId(),
191  QX11Info::appRootWindow(), NET::WMDesktop );
192  if ( ( wm_client.desktop() == NETWinInfo::OnAllDesktops ) ||
193  ( wm_client.desktop() > 0 ) ) {
194  m_config->setDesktop( wm_client.desktop() );
195  }
196 #endif
197 
198  // actually store the config on disk
199  m_config->writeConfig();
200 }
201 
202 QString KNote::noteId() const
203 {
204  return m_journal->uid();
205 }
206 
207 QString KNote::name() const
208 {
209  return m_label->text();
210 }
211 
212 QString KNote::text() const
213 {
214  return m_editor->text();
215 }
216 
217 KCal::Journal *KNote::journal() const
218 {
219  return m_journal;
220 }
221 
222 void KNote::setName( const QString& name )
223 {
224  m_label->setText( name );
225  updateLabelAlignment();
226 
227  if ( m_editor ) { // not called from CTOR?
228  saveData();
229  }
230 #ifdef Q_WS_X11
231  // set the window's name for the taskbar entry to be more helpful (#58338)
232  NETWinInfo note_win( QX11Info::display(), winId(), QX11Info::appRootWindow(),
233  NET::WMDesktop );
234  note_win.setName( name.toUtf8() );
235 #endif
236 
237  emit sigNameChanged(name);
238 }
239 
240 void KNote::setText( const QString& text )
241 {
242  m_editor->setText( text );
243 
244  saveData();
245 }
246 
247 void KNote::find( KFind* kfind )
248 {
249  m_find = kfind;
250  disconnect( m_find );
251  connect( m_find, SIGNAL(highlight(QString,int,int)),
252  this, SLOT(slotHighlight(QString,int,int)) );
253  connect( m_find, SIGNAL(findNext()), this, SLOT(slotFindNext()) );
254 
255  m_find->setData( m_editor->toPlainText() );
256  slotFindNext();
257 }
258 
259 bool KNote::isDesktopAssigned() const
260 {
261  return m_config->rememberDesktop();
262 }
263 
264 void KNote::slotFindNext()
265 {
266  // TODO: honor FindBackwards
267 
268  // Let KFind inspect the text fragment, and display a dialog if a match is
269  // found
270  KFind::Result res = m_find->find();
271 
272  if ( res == KFind::NoMatch ) { // i.e. at end-pos
273 
274  QTextCursor c = m_editor->textCursor(); //doesn't return by reference, so we use setTextCursor
275  c.clearSelection();
276  m_editor->setTextCursor( c );
277 
278  disconnect( m_find, 0, this, 0 );
279  emit sigFindFinished();
280  } else {
281  if (isHidden()) {
282  show();
283  } else {
284  raise();
285  }
286 #ifdef Q_WS_X11
287  KWindowSystem::setCurrentDesktop( KWindowSystem::windowInfo( winId(),
288  NET::WMDesktop ).desktop() );
289 #endif
290  }
291 }
292 
293 void KNote::slotHighlight( const QString& /*str*/, int idx, int len )
294 {
295  m_editor->textCursor().clearSelection();
296  m_editor->highlightWord( len, idx );
297 
298  // TODO: modify the selection color, use a different QTextCursor?
299 }
300 
301 bool KNote::isModified() const
302 {
303  return m_editor->document()->isModified();
304 }
305 
306 // ------------------ private slots (menu actions) ------------------ //
307 
308 void KNote::slotRename()
309 {
310  m_blockEmitDataChanged = true;
311  // pop up dialog to get the new name
312  bool ok;
313  const QString oldName = m_label->text();
314  const QString newName = KInputDialog::getText( QString::null, //krazy:exclude=nullstrassign for old broken gcc
315  i18n( "Please enter the new name:" ), m_label->text(), &ok, this );
316  m_blockEmitDataChanged = false;
317  if ( !ok || (oldName == newName) ) { // handle cancel
318  return;
319  }
320 
321  setName( newName );
322 }
323 
324 void KNote::slotUpdateReadOnly()
325 {
326  const bool readOnly = m_readOnly->isChecked();
327 
328  m_editor->setReadOnly( readOnly );
329  m_config->setReadOnly( readOnly );
330 
331  // enable/disable actions accordingly
332  actionCollection()->action( QLatin1String("configure_note") )->setEnabled( !readOnly );
333  actionCollection()->action( QLatin1String("delete_note") )->setEnabled( !readOnly );
334  actionCollection()->action( QLatin1String("format_bold") )->setEnabled( !readOnly );
335  actionCollection()->action( QLatin1String("format_italic") )->setEnabled( !readOnly );
336  actionCollection()->action( QLatin1String("format_underline") )->setEnabled( !readOnly );
337  actionCollection()->action( QLatin1String("format_strikeout") )->setEnabled( !readOnly );
338  actionCollection()->action( QLatin1String("format_alignleft") )->setEnabled( !readOnly );
339  actionCollection()->action( QLatin1String("format_aligncenter") )->setEnabled( !readOnly );
340  actionCollection()->action( QLatin1String("format_alignright") )->setEnabled( !readOnly );
341  actionCollection()->action( QLatin1String("format_alignblock" ))->setEnabled( !readOnly );
342  actionCollection()->action( QLatin1String("format_list") )->setEnabled( !readOnly );
343  actionCollection()->action( QLatin1String("format_super") )->setEnabled( !readOnly );
344  actionCollection()->action( QLatin1String("format_sub") )->setEnabled( !readOnly );
345  actionCollection()->action( QLatin1String("format_increaseindent" ))->setEnabled( !readOnly );
346  actionCollection()->action( QLatin1String("format_decreaseindent") )->setEnabled( !readOnly );
347  actionCollection()->action( QLatin1String("text_background_color") )->setEnabled( !readOnly );
348  actionCollection()->action( QLatin1String("format_size") )->setEnabled( !readOnly );
349  actionCollection()->action( QLatin1String("format_color") )->setEnabled( !readOnly );
350  actionCollection()->action( QLatin1String("rename_note") )->setEnabled( !readOnly);
351 
352  updateFocus();
353 }
354 
355 
356 void KNote::commitData()
357 {
358  mBlockWriteConfigDuringCommitData = true;
359 }
360 
361 void KNote::slotClose()
362 {
363 #ifdef Q_WS_X11
364  NETWinInfo wm_client( QX11Info::display(), winId(),
365  QX11Info::appRootWindow(), NET::WMDesktop );
366  if ( ( wm_client.desktop() == NETWinInfo::OnAllDesktops ) ||
367  ( wm_client.desktop() > 0 ) ) {
368  m_config->setDesktop( wm_client.desktop() );
369  }
370 #endif
371 
372  m_editor->clearFocus();
373  if( !mBlockWriteConfigDuringCommitData ) {
374  m_config->setHideNote( true );
375  m_config->setPosition( pos() );
376  m_config->writeConfig();
377  }
378  // just hide the note so it's still available from the dock window
379  hide();
380 }
381 
382 void KNote::slotSetAlarm()
383 {
384  m_blockEmitDataChanged = true;
385  QPointer<KNoteAlarmDialog> dlg = new KNoteAlarmDialog( name(), this );
386  dlg->setIncidence( m_journal );
387 
388  if ( dlg->exec() ) {
389  emit sigDataChanged(noteId());
390  }
391  delete dlg;
392  m_blockEmitDataChanged = false;
393 }
394 
395 void KNote::slotPreferences()
396 {
397  m_blockEmitDataChanged = true;
398 
399  // create a new preferences dialog...
400  QPointer<KNoteSimpleConfigDialog> dialog = new KNoteSimpleConfigDialog( m_config, name(), this, noteId() );
401  connect( dialog, SIGNAL(settingsChanged(QString)) , this,
402  SLOT(slotApplyConfig()) );
403  connect( this, SIGNAL(sigNameChanged(QString)), dialog,
404  SLOT(slotUpdateCaption(QString)) );
405  dialog->exec();
406  delete dialog;
407  m_blockEmitDataChanged = false;
408  saveData();
409 }
410 
411 void KNote::slotSend()
412 {
413  KNoteUtils::sendToNetwork(this, name(), text());
414 }
415 
416 void KNote::slotMail()
417 {
418  KNoteUtils::sendMail(this, m_label->text(), m_editor->toPlainText());
419 }
420 
421 void KNote::slotPrint()
422 {
423  print(false);
424 }
425 
426 void KNote::slotPrintPreview()
427 {
428  print(true);
429 }
430 
431 void KNote::print(bool preview)
432 {
433  QString content;
434  if ( !Qt::mightBeRichText( m_editor->text() ) ) {
435  content = Qt::convertFromPlainText( m_editor->text() );
436  } else {
437  content = m_editor->text();
438  }
439  if ( isModified() ) {
440  saveConfig();
441  if ( !m_blockEmitDataChanged ) {
442  saveData();
443  }
444  }
445 
446  KNotePrinter printer;
447  QList<KNotePrintObject*> lst;
448  lst.append(new KNotePrintObject(m_journal));
449  printer.setDefaultFont( m_config->font() );
450 
451  KNotesGlobalConfig *globalConfig = KNotesGlobalConfig::self();
452  QString printingTheme = globalConfig->theme();
453  if (printingTheme.isEmpty()) {
454  QPointer<KNotePrintSelectThemeDialog> dlg = new KNotePrintSelectThemeDialog(this);
455  if (dlg->exec()) {
456  printingTheme = dlg->selectedTheme();
457  }
458  delete dlg;
459  }
460  if (!printingTheme.isEmpty()) {
461  printer.printNotes( lst, printingTheme, preview );
462  }
463 }
464 
465 void KNote::slotSaveAs()
466 {
467  // TODO: where to put pdf file support? In the printer??!??!
468  m_blockEmitDataChanged = true;
469  QCheckBox *convert = 0;
470 
471  if ( m_editor->acceptRichText() ) {
472  convert = new QCheckBox( 0 );
473  convert->setText( i18n( "Save note as plain text" ) );
474  }
475  m_blockEmitDataChanged = true;
476  KUrl url;
477  QPointer<KFileDialog> dlg = new KFileDialog( url, QString(), this, convert );
478  dlg->setOperationMode( KFileDialog::Saving );
479  dlg->setCaption( i18n( "Save As" ) );
480  if( !dlg->exec() ) {
481  m_blockEmitDataChanged = false;
482  delete dlg;
483  return;
484  }
485 
486  QString fileName = dlg->selectedFile();
487  const bool htmlFormatAndSaveAsHtml = (convert && !convert->isChecked());
488  delete dlg;
489  if ( fileName.isEmpty() ) {
490  m_blockEmitDataChanged = false;
491  return;
492  }
493 
494  QFile file( fileName );
495 
496  if ( file.exists() &&
497  KMessageBox::warningContinueCancel( this,
498  i18n( "<qt>A file named <b>%1</b> already exists.<br />"
499  "Are you sure you want to overwrite it?</qt>",
500  QFileInfo( file ).fileName() ) ) != KMessageBox::Continue ) {
501  m_blockEmitDataChanged = false;
502  return;
503  }
504 
505  if ( file.open( QIODevice::WriteOnly ) ) {
506  QTextStream stream( &file );
507  if ( htmlFormatAndSaveAsHtml ) {
508  stream << m_editor->toHtml();
509  } else {
510  stream << m_editor->toPlainText();
511  }
512  }
513  m_blockEmitDataChanged = false;
514 }
515 
516 void KNote::slotPopupActionToDesktop( int id )
517 {
518  toDesktop( id - 1 ); // compensate for the menu separator, -1 == all desktops
519 }
520 
521 
522 // ------------------ private slots (configuration) ------------------ //
523 
524 void KNote::slotApplyConfig()
525 {
526  m_label->setFont( m_config->titleFont() );
527  m_editor->setRichText( m_config->richText() );
528  m_editor->setTextFont( m_config->font() );
529  m_editor->setTabStop( m_config->tabSize() );
530  m_editor->setAutoIndentMode( m_config->autoIndent() );
531 
532  setColor( m_config->fgColor(), m_config->bgColor() );
533 
534  updateLayout();
535  slotUpdateShowInTaskbar();
536 }
537 
538 void KNote::slotKeepAbove()
539 {
540  if ( m_keepBelow->isChecked() )
541  {
542  m_keepBelow->setChecked( false );
543  }
544  slotUpdateKeepAboveBelow();
545 }
546 
547 void KNote::slotKeepBelow()
548 {
549  if ( m_keepAbove->isChecked() )
550  {
551  m_keepAbove->setChecked( false );
552  }
553  slotUpdateKeepAboveBelow();
554 }
555 
556 void KNote::slotUpdateKeepAboveBelow()
557 {
558 #ifdef Q_WS_X11
559  unsigned long state = KWindowInfo( KWindowSystem::windowInfo( winId(), NET::WMState ) ).state();
560 #else
561  unsigned long state = 0; // neutral state, TODO
562 #endif
563  if ( m_keepAbove->isChecked() ) {
564  m_config->setKeepAbove( true );
565  m_config->setKeepBelow( false );
566  KWindowSystem::setState( winId(), state | NET::KeepAbove );
567  } else if ( m_keepBelow->isChecked() ) {
568  m_config->setKeepAbove( false );
569  m_config->setKeepBelow( true );
570  KWindowSystem::setState( winId(), state | NET::KeepBelow );
571  } else {
572  m_config->setKeepAbove( false );
573  KWindowSystem::clearState( winId(), NET::KeepAbove );
574  m_config->setKeepBelow( false );
575  KWindowSystem::clearState( winId(), NET::KeepBelow );
576  }
577 }
578 
579 void KNote::slotUpdateShowInTaskbar()
580 {
581 #ifdef Q_WS_X11
582  if ( !m_config->showInTaskbar() ) {
583  KWindowSystem::setState( winId(), KWindowSystem::windowInfo( winId(),
584  NET::WMState ).state() | NET::SkipTaskbar );
585  } else {
586  KWindowSystem::clearState( winId(), NET::SkipTaskbar );
587  }
588 #endif
589 }
590 
591 void KNote::slotUpdateDesktopActions()
592 {
593 #ifdef Q_WS_X11
594  m_toDesktop->clear();
595  NETRootInfo wm_root( QX11Info::display(), NET::NumberOfDesktops |
596  NET::DesktopNames );
597  NETWinInfo wm_client( QX11Info::display(), winId(),
598  QX11Info::appRootWindow(), NET::WMDesktop );
599 
600  KAction *act = m_toDesktop->addAction(i18n( "&All Desktops" ));
601  if (wm_client.desktop() == NETWinInfo::OnAllDesktops) {
602  act->setChecked(true);
603  }
604  QAction *separator = new QAction(m_toDesktop);
605  separator->setSeparator(true);
606  m_toDesktop->addAction(separator);
607  const int count = wm_root.numberOfDesktops();
608  for ( int n = 1; n <= count; ++n ) {
609  KAction *desktopAct = m_toDesktop->addAction(QString::fromLatin1( "&%1 %2" ).arg( n ).arg(QString::fromUtf8( wm_root.desktopName( n ) ) ));
610  if (wm_client.desktop() == n) {
611  desktopAct->setChecked(true);
612  }
613  }
614 #endif
615 }
616 
617 
618 // -------------------- private methods -------------------- //
619 
620 void KNote::buildGui(const QString &configFile)
621 {
622  createNoteHeader();
623  createNoteEditor(configFile);
624 
625  KXMLGUIBuilder builder( this );
626  KXMLGUIFactory factory( &builder, this );
627  factory.addClient( this );
628 
629  m_menu = dynamic_cast<KMenu*>( factory.container( QLatin1String("note_context"), this ) );
630  m_tool = dynamic_cast<KToolBar*>( factory.container( QLatin1String("note_tool"), this ) );
631 
632  createNoteFooter();
633 }
634 
635 void KNote::createActions()
636 {
637  // create the menu items for the note - not the editor...
638  // rename, mail, print, save as, insert date, alarm, close, delete, new note
639  KAction *action;
640 
641  action = new KAction( KIcon( QLatin1String("document-new") ), i18n( "New" ), this );
642  actionCollection()->addAction( QLatin1String("new_note"), action );
643  connect( action, SIGNAL(triggered(bool)), SLOT(slotRequestNewNote()) );
644 
645  action = new KAction( KIcon( QLatin1String("edit-rename") ), i18n( "Rename..." ), this );
646  actionCollection()->addAction( QLatin1String("rename_note"), action );
647  connect( action, SIGNAL(triggered(bool)), SLOT(slotRename()) );
648 
649  m_readOnly = new KToggleAction( KIcon( QLatin1String("object-locked") ),
650  i18n( "Lock" ), this );
651  actionCollection()->addAction( QLatin1String("lock_note"), m_readOnly );
652  connect( m_readOnly, SIGNAL(triggered(bool)),
653  SLOT(slotUpdateReadOnly()) );
654  m_readOnly->setCheckedState( KGuiItem( i18n( "Unlock" ), QLatin1String("object-unlocked") ) );
655 
656  action = new KAction( KIcon( QLatin1String("window-close") ), i18n( "Hide" ), this );
657  actionCollection()->addAction( QLatin1String("hide_note"), action );
658  connect( action, SIGNAL(triggered(bool)), SLOT(slotClose()) );
659  action->setShortcut( QKeySequence( Qt::Key_Escape ) );
660 
661  action = new KAction( KIcon( QLatin1String("edit-delete") ), i18n( "Delete" ), this );
662  actionCollection()->addAction( QLatin1String("delete_note"), action );
663  connect( action, SIGNAL(triggered(bool)), SLOT(slotKill()),Qt::QueuedConnection );
664 
665  action = new KAction( KIcon( QLatin1String("knotes_alarm") ), i18n( "Set Alarm..." ),
666  this );
667  actionCollection()->addAction( QLatin1String("set_alarm"), action );
668  connect( action, SIGNAL(triggered(bool)), SLOT(slotSetAlarm()) );
669 
670  action = new KAction( KIcon( QLatin1String("network-wired") ), i18n( "Send..." ), this );
671  actionCollection()->addAction( QLatin1String("send_note"), action );
672  connect( action, SIGNAL(triggered(bool)), SLOT(slotSend()) );
673 
674  action = new KAction( KIcon( QLatin1String("mail-send") ), i18n( "Mail..." ), this );
675  actionCollection()->addAction( QLatin1String("mail_note"), action );
676  connect( action, SIGNAL(triggered(bool)), SLOT(slotMail()) );
677 
678  action = new KAction( KIcon( QLatin1String("document-save-as") ), i18n( "Save As..." ),
679  this );
680  actionCollection()->addAction( QLatin1String("save_note"), action );
681  connect( action, SIGNAL(triggered(bool)), SLOT(slotSaveAs()) );
682  actionCollection()->addAction( KStandardAction::Print, QLatin1String("print_note"), this,
683  SLOT(slotPrint()) );
684 
685  if (KPrintPreview::isAvailable()) {
686  actionCollection()->addAction( KStandardAction::PrintPreview, QLatin1String("print_preview_note"), this,
687  SLOT(slotPrintPreview()) );
688  }
689  action = new KAction( KIcon( QLatin1String("configure") ), i18n( "Preferences..." ), this );
690  actionCollection()->addAction( QLatin1String("configure_note"), action );
691  connect( action, SIGNAL(triggered(bool)), SLOT(slotPreferences()) );
692 
693 
694  m_keepAbove = new KToggleAction( KIcon( QLatin1String("go-up") ),
695  i18n( "Keep Above Others" ), this );
696  actionCollection()->addAction( QLatin1String("keep_above"), m_keepAbove );
697  connect( m_keepAbove, SIGNAL(triggered(bool)),
698  SLOT(slotKeepAbove()) );
699 
700  m_keepBelow = new KToggleAction( KIcon( QLatin1String("go-down") ),
701  i18n( "Keep Below Others" ), this );
702  actionCollection()->addAction( QLatin1String("keep_below"), m_keepBelow );
703  connect( m_keepBelow, SIGNAL(triggered(bool)),
704  SLOT(slotKeepBelow()) );
705 
706 #ifdef Q_WS_X11
707  m_toDesktop = new KSelectAction( i18n( "To Desktop" ), this );
708  actionCollection()->addAction( QLatin1String("to_desktop"), m_toDesktop );
709  connect( m_toDesktop, SIGNAL(triggered(int)),
710  SLOT(slotPopupActionToDesktop(int)) );
711  connect( m_toDesktop->menu(), SIGNAL(aboutToShow()),
712  SLOT(slotUpdateDesktopActions()) );
713  // initially populate it, otherwise stays disabled
714  slotUpdateDesktopActions();
715 #endif
716 
717  // invisible action to walk through the notes to make this configurable
718  action = new KAction( i18n( "Walk Through Notes" ), this );
719  actionCollection()->addAction( QLatin1String("walk_notes"), action );
720  connect( action, SIGNAL(triggered(bool)), SIGNAL(sigShowNextNote()) );
721  action->setShortcut( QKeySequence( Qt::SHIFT + Qt::Key_Backtab ) );
722 
723  actionCollection()->addAssociatedWidget( this );
724  foreach (QAction* action, actionCollection()->actions())
725  action->setShortcutContext(Qt::WidgetWithChildrenShortcut);
726 }
727 
728 void KNote::createNoteHeader()
729 {
730  // load style configuration
731  KConfigGroup styleGroup( m_kwinConf, "Style" );
732 
733  QBoxLayout::Direction headerLayoutDirection = QBoxLayout::LeftToRight;
734 
735  if ( styleGroup.readEntry( "CustomButtonPositions", false ) ) {
736  if ( styleGroup.readEntry( "ButtonsOnLeft" ).contains( QLatin1Char('X') ) ) {
737  headerLayoutDirection = QBoxLayout::RightToLeft;
738  }
739  }
740 
741  QBoxLayout *headerLayout = new QBoxLayout( headerLayoutDirection);
742 
743 
744  // create header label
745  m_label = new QLabel( this );
746  headerLayout->addWidget( m_label );
747  m_label->setFrameStyle( NoFrame );
748  m_label->setBackgroundRole( QPalette::Base );
749  m_label->setLineWidth( 0 );
750  m_label->setAutoFillBackground( true );
751  m_label->installEventFilter( this ); // receive events ( for dragging &
752  // action menu )
753  setName( m_journal->summary() ); // don't worry, no signals are
754  // connected at this stage yet
755  m_button = new KNoteButton( QLatin1String("knotes_close"), this );
756  headerLayout->addWidget( m_button );
757 
758  connect( m_button, SIGNAL(clicked()), this, SLOT(slotClose()) );
759 
760  m_noteLayout->addItem( headerLayout );
761 }
762 
763 void KNote::createNoteEditor(const QString &configFile)
764 {
765  m_editor = new KNoteEdit( configFile, actionCollection(), this );
766  m_noteLayout->addWidget( m_editor );
767  m_editor->setNote( this );
768  m_editor->installEventFilter( this ); // receive focus events for modified
769  setFocusProxy( m_editor );
770 }
771 
772 void KNote::slotRequestNewNote()
773 {
774  //Be sure to save before to request a new note
775  saveConfig();
776  saveData();
777  emit sigRequestNewNote();
778 }
779 
780 void KNote::createNoteFooter()
781 {
782  if ( m_tool ) {
783  m_tool->setIconSize( QSize( 10, 10 ) );
784  m_tool->setFixedHeight( 24 );
785  m_tool->setToolButtonStyle( Qt::ToolButtonIconOnly );
786  }
787 
788  // create size grip
789  QHBoxLayout *gripLayout = new QHBoxLayout;
790  m_grip = new QSizeGrip( this );
791  m_grip->setFixedSize( m_grip->sizeHint() );
792 
793  if ( m_tool ) {
794  gripLayout->addWidget( m_tool );
795  gripLayout->setAlignment( m_tool, Qt::AlignBottom | Qt::AlignLeft );
796  m_tool->hide();
797  }
798 
799  gripLayout->addWidget( m_grip );
800  gripLayout->setAlignment( m_grip, Qt::AlignBottom | Qt::AlignRight );
801  m_noteLayout->addItem( gripLayout );
802 
803  // if there was just a way of making KComboBox adhere the toolbar height...
804  if ( m_tool ) {
805  foreach ( KComboBox *combo, m_tool->findChildren<KComboBox *>() ) {
806  QFont font = combo->font();
807  font.setPointSize( 7 );
808  combo->setFont( font );
809  combo->setFixedHeight( 14 );
810  }
811  }
812 }
813 
814 void KNote::prepare()
815 {
816  // load the display configuration of the note
817  uint width = m_config->width();
818  uint height = m_config->height();
819  resize( width, height );
820 
821  // let KWin do the placement if the position is illegal--at least 10 pixels
822  // of a note need to be visible
823  const QPoint& position = m_config->position();
824  QRect desk = kapp->desktop()->rect();
825  desk.adjust( 10, 10, -10, -10 );
826  if ( desk.intersects( QRect( position, QSize( width, height ) ) ) ) {
827  move( position ); // do before calling show() to avoid flicker
828  }
829 
830  KNoteUtils::setProperty(m_journal, m_config);
831 
832  // read configuration settings...
833  slotApplyConfig();
834 
835  // if this is a new note put on current desktop - we can't use defaults
836  // in KConfig XT since only _changes_ will be stored in the config file
837  int desktop = m_config->desktop();
838 
839 #ifdef Q_WS_X11
840  if ( ( desktop < 0 && desktop != NETWinInfo::OnAllDesktops ) ||
841  !m_config->rememberDesktop() )
842  desktop = KWindowSystem::currentDesktop();
843 #endif
844 
845  // show the note if desired
846  if ( desktop != 0 && !m_config->hideNote() ) {
847  // to avoid flicker, call this before show()
848  toDesktop( desktop );
849  show();
850 
851  // because KWin forgets about that for hidden windows
852 #ifdef Q_WS_X11
853  if ( desktop == NETWinInfo::OnAllDesktops ) {
854  toDesktop( desktop );
855  }
856 #endif
857  }
858 
859  m_readOnly->setChecked( m_config->readOnly() );
860  slotUpdateReadOnly();
861 
862  if ( m_config->keepAbove() ) {
863  m_keepAbove->setChecked( true );
864  } else if ( m_config->keepBelow() ) {
865  m_keepBelow->setChecked( true );
866  } else {
867  m_keepAbove->setChecked( false );
868  m_keepBelow->setChecked( false );
869  }
870  slotUpdateKeepAboveBelow();
871 
872  // HACK: update the icon color - again after showing the note, to make kicker
873  // aware of the new colors
874  KIconEffect effect;
875  QPixmap icon = effect.apply( qApp->windowIcon().pixmap(
876  IconSize( KIconLoader::Desktop ),
877  IconSize( KIconLoader::Desktop ) ),
878  KIconEffect::Colorize,
879  1, m_config->bgColor(), false );
880  QPixmap miniIcon = effect.apply( qApp->windowIcon().pixmap(
881  IconSize( KIconLoader::Small ),
882  IconSize( KIconLoader::Small ) ),
883  KIconEffect::Colorize,
884  1, m_config->bgColor(), false );
885 #ifdef Q_WS_X11
886  KWindowSystem::setIcons( winId(), icon, miniIcon );
887 #endif
888 
889  // set up the look&feel of the note
890  setFrameStyle( Panel | Raised );
891  setMinimumSize( 20, 20 );
892  setBackgroundRole( QPalette::Base );
893 
894  m_editor->setContentsMargins( 0, 0, 0, 0 );
895  m_editor->setBackgroundRole( QPalette::Base );
896  m_editor->setFrameStyle( NoFrame );
897  m_editor->setText( m_journal->description() );
898 
899  m_editor->document()->setModified( false );
900 }
901 
902 void KNote::toDesktop( int desktop )
903 {
904  if ( desktop == 0 ) {
905  return;
906  }
907 
908 #ifdef Q_WS_X11
909  if ( desktop == NETWinInfo::OnAllDesktops ) {
910  KWindowSystem::setOnAllDesktops( winId(), true );
911  } else {
912  KWindowSystem::setOnDesktop( winId(), desktop );
913  }
914 #endif
915 }
916 
917 void KNote::setColor( const QColor &fg, const QColor &bg )
918 {
919  QPalette p = palette();
920 
921  // better: from light(150) to light(100) to light(75)
922  // QLinearGradient g( width()/2, 0, width()/2, height() );
923  // g.setColorAt( 0, bg );
924  // g.setColorAt( 1, bg.dark(150) );
925 
926  p.setColor( QPalette::Window, bg );
927  // p.setBrush( QPalette::Window, g );
928  p.setColor( QPalette::Base, bg );
929  // p.setBrush( QPalette::Base, g );
930 
931  p.setColor( QPalette::WindowText, fg );
932  p.setColor( QPalette::Text, fg );
933 
934  p.setColor( QPalette::Button, bg.dark( 116 ) );
935  p.setColor( QPalette::ButtonText, fg );
936 
937  //p.setColor( QPalette::Highlight, bg );
938  //p.setColor( QPalette::HighlightedText, fg );
939 
940  // order: Light, Midlight, Button, Mid, Dark, Shadow
941 
942  // the shadow
943  p.setColor( QPalette::Light, bg.light( 180 ) );
944  p.setColor( QPalette::Midlight, bg.light( 150 ) );
945  p.setColor( QPalette::Mid, bg.light( 150 ) );
946  p.setColor( QPalette::Dark, bg.dark( 108 ) );
947  p.setColor( QPalette::Shadow, bg.dark( 116 ) );
948 
949  setPalette( p );
950 
951  // darker values for the active label
952  p.setColor( QPalette::Active, QPalette::Base, bg.dark( 116 ) );
953 
954  m_label->setPalette( p );
955 
956  // set the text color
957  m_editor->setTextColor( fg );
958 
959  // update the icon color
960  KIconEffect effect;
961  QPixmap icon = effect.apply( qApp->windowIcon().pixmap(
962  IconSize( KIconLoader::Desktop ),
963  IconSize( KIconLoader::Desktop ) ),
964  KIconEffect::Colorize, 1, bg, false );
965  QPixmap miniIcon = effect.apply( qApp->windowIcon().pixmap(
966  IconSize( KIconLoader::Small ),
967  IconSize( KIconLoader::Small ) ),
968  KIconEffect::Colorize, 1, bg, false );
969 #ifdef Q_WS_X11
970  KWindowSystem::setIcons( winId(), icon, miniIcon );
971 #endif
972  // update the color of the title
973  updateFocus();
974  emit sigColorChanged();
975 }
976 
977 void KNote::updateLabelAlignment()
978 {
979  // if the name is too long to fit, left-align it, otherwise center it (#59028)
980  const QString labelText = m_label->text();
981  if ( m_label->fontMetrics().boundingRect( labelText ).width() >
982  m_label->width() ) {
983  m_label->setAlignment( Qt::AlignLeft );
984  } else {
985  m_label->setAlignment( Qt::AlignHCenter );
986  }
987 }
988 
989 void KNote::updateFocus()
990 {
991  if ( hasFocus() )
992  {
993 
994  if ( !m_editor->isReadOnly() )
995  {
996  if ( m_tool && m_tool->isHidden() && m_editor->acceptRichText() )
997  {
998  m_tool->show();
999  updateLayout();
1000  }
1001  m_grip->show();
1002  }
1003  else
1004  {
1005  if ( m_tool && !m_tool->isHidden() ) {
1006  m_tool->hide();
1007  updateLayout(); // to update the minimum height
1008  }
1009  m_grip->hide();
1010  }
1011  }
1012  else
1013  {
1014  m_grip->hide();
1015 
1016  if ( m_tool && !m_tool->isHidden() )
1017  {
1018  m_tool->hide();
1019  updateLayout(); // to update the minimum height
1020  }
1021  }
1022 }
1023 
1024 void KNote::updateLayout()
1025 {
1026  // TODO: remove later if no longer needed.
1027  updateLabelAlignment();
1028 }
1029 
1030 // -------------------- protected methods -------------------- //
1031 
1032 void KNote::contextMenuEvent( QContextMenuEvent *e )
1033 {
1034  if ( m_menu ) {
1035  m_menu->popup( e->globalPos() );
1036  }
1037 }
1038 
1039 void KNote::showEvent( QShowEvent * )
1040 {
1041  if ( m_config->hideNote() ) {
1042  // KWin does not preserve these properties for hidden windows
1043  slotUpdateKeepAboveBelow();
1044  slotUpdateShowInTaskbar();
1045  toDesktop( m_config->desktop() );
1046  move( m_config->position() );
1047  m_config->setHideNote( false );
1048  }
1049 }
1050 
1051 void KNote::resizeEvent( QResizeEvent *qre )
1052 {
1053  QFrame::resizeEvent( qre );
1054  updateLayout();
1055 }
1056 
1057 void KNote::closeEvent( QCloseEvent * event )
1058 {
1059  if ( kapp->sessionSaving() ) {
1060  return;
1061  }
1062  event->ignore(); //We don't want to close (and delete the widget). Just hide it
1063  slotClose();
1064 }
1065 
1066 void KNote::dragEnterEvent( QDragEnterEvent *e )
1067 {
1068  if ( !m_config->readOnly() ) {
1069  e->setAccepted( e->mimeData()->hasColor() );
1070  }
1071 }
1072 
1073 void KNote::dropEvent( QDropEvent *e )
1074 {
1075  if ( m_config->readOnly() ) {
1076  return;
1077  }
1078 
1079  const QMimeData *md = e->mimeData();
1080  if ( md->hasColor() ) {
1081  QColor bg = qvariant_cast<QColor>( md->colorData() );
1082  setColor( palette().color( foregroundRole() ), bg );
1083  m_journal->setCustomProperty( "KNotes", "BgColor", bg.name() );
1084  m_config->setBgColor( bg );
1085  }
1086 }
1087 
1088 bool KNote::event( QEvent *ev )
1089 {
1090  if ( ev->type() == QEvent::LayoutRequest ) {
1091  updateLayout();
1092  return true;
1093  } else {
1094  return QFrame::event( ev );
1095  }
1096 }
1097 
1098 bool KNote::eventFilter( QObject *o, QEvent *ev )
1099 {
1100  if ( ev->type() == QEvent::DragEnter &&
1101  static_cast<QDragEnterEvent*>( ev )->mimeData()->hasColor() ) {
1102  dragEnterEvent( static_cast<QDragEnterEvent *>( ev ) );
1103  return true;
1104  }
1105 
1106  if ( ev->type() == QEvent::Drop &&
1107  static_cast<QDropEvent *>( ev )->mimeData()->hasColor() ) {
1108  dropEvent( static_cast<QDropEvent *>( ev ) );
1109  return true;
1110  }
1111 
1112  if ( o == m_label ) {
1113  QMouseEvent *e = ( QMouseEvent * )ev;
1114 
1115  if ( ev->type() == QEvent::MouseButtonDblClick ) {
1116  if(!m_editor->isReadOnly())
1117  slotRename();
1118  }
1119 
1120  if ( ev->type() == QEvent::MouseButtonPress &&
1121  ( e->button() == Qt::LeftButton || e->button() == Qt::MidButton ) ) {
1122 #ifdef Q_WS_X11
1123  e->button() == Qt::LeftButton ? KWindowSystem::raiseWindow( winId() )
1124  : KWindowSystem::lowerWindow( winId() );
1125 
1126  XUngrabPointer( QX11Info::display(), QX11Info::appTime() );
1127  NETRootInfo wm_root( QX11Info::display(), NET::WMMoveResize );
1128  wm_root.moveResizeRequest( winId(), e->globalX(), e->globalY(),
1129  NET::Move );
1130 #endif
1131  return true;
1132  }
1133 
1134  if ( ev->type() == QEvent::MouseButtonRelease ) {
1135 #ifdef Q_WS_X11
1136  NETRootInfo wm_root( QX11Info::display(), NET::WMMoveResize );
1137  wm_root.moveResizeRequest( winId(), e->globalX(), e->globalY(),
1138  NET::MoveResizeCancel );
1139 #endif
1140  return false;
1141  }
1142 
1143  return false;
1144  }
1145 
1146  if ( o == m_editor ) {
1147  if ( ev->type() == QEvent::FocusOut ) {
1148  QFocusEvent *fe = static_cast<QFocusEvent *>( ev );
1149  if ( fe->reason() != Qt::PopupFocusReason &&
1150  fe->reason() != Qt::MouseFocusReason ) {
1151  updateFocus();
1152  if ( isModified() ) {
1153  saveConfig();
1154  if ( !m_blockEmitDataChanged )
1155  saveData();
1156  }
1157  }
1158  } else if ( ev->type() == QEvent::FocusIn ) {
1159  updateFocus();
1160  }
1161 
1162  return false;
1163  }
1164 
1165  return false;
1166 }
1167 
1168 
1169 #include "knote.moc"
KNote::slotKill
void slotKill(bool force=false)
Definition: knote.cpp:145
knoteprintselectthemedialog.h
KNoteConfig::rememberDesktop
bool rememberDesktop() const
Get RememberDesktop.
Definition: knoteconfig.h:100
knotealarmdialog.h
KNotePrintSelectThemeDialog
Definition: knoteprintselectthemedialog.h:26
KNote::commitData
void commitData()
Definition: knote.cpp:356
KNoteEdit::setTextFont
void setTextFont(const QFont &font)
Definition: knoteedit.cpp:265
KNoteConfig::setKeepAbove
void setKeepAbove(bool v)
Set KeepAbove.
Definition: knoteconfig.h:295
KNotePrintObject
Definition: knoteprintobject.h:29
KNoteConfig::desktop
int desktop() const
Get desktop.
Definition: knoteconfig.h:236
KNote::isModified
bool isModified() const
Definition: knote.cpp:301
KNotePrinter::printNotes
void printNotes(const QList< KNotePrintObject * > lst, const QString &themePath, bool preview)
Definition: knoteprinter.cpp:125
KNote::~KNote
~KNote()
Definition: knote.cpp:128
KNote::journal
KCal::Journal * journal() const
Definition: knote.cpp:217
KNoteConfig::setBgColor
void setBgColor(const QColor &v)
Set bgcolor.
Definition: knoteconfig.h:23
KNoteEdit
Definition: knoteedit.h:39
KNote::changeJournal
void changeJournal(KCal::Journal *)
Definition: knote.cpp:133
KNote::sigKillNote
void sigKillNote(KCal::Journal *)
KNote::showEvent
virtual void showEvent(QShowEvent *)
Definition: knote.cpp:1039
QWidget
KNote::saveConfig
void saveConfig() const
Definition: knote.cpp:183
KNote::isDesktopAssigned
bool isDesktopAssigned() const
Definition: knote.cpp:259
KNote::slotClose
void slotClose()
Definition: knote.cpp:361
KNoteConfig::setReadOnly
void setReadOnly(bool v)
Set ReadOnly.
Definition: knoteconfig.h:193
KNoteConfig::showInTaskbar
bool showInTaskbar() const
Get ShowInTaskbar.
Definition: knoteconfig.h:287
KNoteEdit::setAutoIndentMode
void setAutoIndentMode(bool newmode)
Definition: knoteedit.cpp:285
KNoteConfig::autoIndent
bool autoIndent() const
Get autoindent.
Definition: knoteconfig.h:151
KNoteEdit::text
QString text() const
Definition: knoteedit.cpp:256
KNote::sigShowNextNote
void sigShowNextNote()
QObject
KNotePrinter::setDefaultFont
void setDefaultFont(const QFont &font)
Definition: knoteprinter.cpp:52
KNoteButton
Definition: knotebutton.h:27
KNoteConfig::height
uint height() const
Get height.
Definition: knoteconfig.h:83
knoteconfigdialog.h
KNoteConfig::bgColor
QColor bgColor() const
Get bgcolor.
Definition: knoteconfig.h:32
KNoteEdit::setTabStop
void setTabStop(int tabs)
Definition: knoteedit.cpp:279
KNote::dropEvent
virtual void dropEvent(QDropEvent *)
Definition: knote.cpp:1073
KNote::KNote
KNote(const QDomDocument &buildDoc, KCal::Journal *journal, QWidget *parent=0)
Definition: knote.cpp:87
KNote::eventFilter
virtual bool eventFilter(QObject *, QEvent *)
Definition: knote.cpp:1098
knote.h
knotesimpleconfigdialog.h
KNoteEdit::setRichText
void setRichText(bool)
public slots
Definition: knoteedit.cpp:293
KNoteUtils::createConfig
KNOTES_EXPORT KNoteConfig * createConfig(KCal::Journal *journal, QString &configPath)
Definition: knoteutils.cpp:38
KNoteConfig::setPosition
void setPosition(const QPoint &v)
Set position.
Definition: knoteconfig.h:261
knoteprintobject.h
KNoteConfig::titleFont
QFont titleFont() const
Get titlefont.
Definition: knoteconfig.h:134
KNote::slotRename
void slotRename()
Definition: knote.cpp:308
knotebutton.h
KNote::sigDataChanged
void sigDataChanged(const QString &)
KNoteEdit::setText
void setText(const QString &text)
Definition: knoteedit.cpp:247
KNoteConfig::tabSize
uint tabSize() const
Get tabsize.
Definition: knoteconfig.h:185
KNote::sigColorChanged
void sigColorChanged()
knoteprinter.h
KNoteConfig::setHideNote
void setHideNote(bool v)
Set HideNote.
Definition: knoteconfig.h:244
KNoteEdit::setNote
void setNote(KNote *_note)
Definition: knoteedit.cpp:198
KNote::text
QString text() const
Definition: knote.cpp:212
KNote::name
QString name() const
Definition: knote.cpp:207
knoteutils.h
KNote::resizeEvent
virtual void resizeEvent(QResizeEvent *)
Definition: knote.cpp:1051
KNoteUtils::setProperty
KNOTES_EXPORT void setProperty(KCal::Journal *journal, KNoteConfig *config)
Definition: knoteutils.cpp:80
KNoteUtils::removeNote
KNOTES_EXPORT void removeNote(KCal::Journal *journal, QWidget *parent)
Definition: knoteutils.cpp:108
KNote::sigFindFinished
void sigFindFinished()
KNote::saveData
void saveData(bool update=true)
Definition: knote.cpp:170
KNote::event
virtual bool event(QEvent *)
Definition: knote.cpp:1088
KNote::find
void find(KFind *kfind)
Definition: knote.cpp:247
KNote::noteId
QString noteId() const
Definition: knote.cpp:202
KNoteConfig::fgColor
QColor fgColor() const
Get fgcolor.
Definition: knoteconfig.h:49
KNote::dragEnterEvent
virtual void dragEnterEvent(QDragEnterEvent *)
Definition: knote.cpp:1066
KNoteConfig::setHeight
void setHeight(uint v)
Set height.
Definition: knoteconfig.h:74
KNoteConfig::font
QFont font() const
Get font.
Definition: knoteconfig.h:117
KNote::closeEvent
virtual void closeEvent(QCloseEvent *)
Definition: knote.cpp:1057
KNoteConfig::hideNote
bool hideNote() const
Get HideNote.
Definition: knoteconfig.h:253
KNotePrinter
Definition: knoteprinter.h:33
KNote::contextMenuEvent
virtual void contextMenuEvent(QContextMenuEvent *)
Definition: knote.cpp:1032
KNoteConfig::richText
bool richText() const
Get richtext.
Definition: knoteconfig.h:168
KNote::setName
void setName(const QString &name)
Definition: knote.cpp:222
KNoteAlarmDialog
Definition: knotealarmdialog.h:44
KNote::sigRequestNewNote
void sigRequestNewNote()
KNoteSimpleConfigDialog
Definition: knotesimpleconfigdialog.h:26
KNoteConfig::setDesktop
void setDesktop(int v)
Set desktop.
Definition: knoteconfig.h:227
KNoteUtils::savePreferences
KNOTES_EXPORT void savePreferences(KCal::Journal *journal, KNoteConfig *config)
Definition: knoteutils.cpp:117
KNote::toDesktop
void toDesktop(int desktop)
Definition: knote.cpp:902
knoteedit.h
KNoteConfig::width
uint width() const
Get width.
Definition: knoteconfig.h:66
QFrame
knoteconfig.h
KNoteConfig::setWidth
void setWidth(uint v)
Set width.
Definition: knoteconfig.h:57
KNoteConfig::position
QPoint position() const
Get position.
Definition: knoteconfig.h:270
KNoteConfig::keepAbove
bool keepAbove() const
Get KeepAbove.
Definition: knoteconfig.h:304
KNote::setText
void setText(const QString &text)
Definition: knote.cpp:240
KNoteConfig::readOnly
bool readOnly() const
Get ReadOnly.
Definition: knoteconfig.h:202
KNoteUtils::sendMail
KNOTES_EXPORT void sendMail(QWidget *parent, const QString &title, const QString &message)
Definition: knoteutils.cpp:128
KNoteConfig::setKeepBelow
void setKeepBelow(bool v)
Set KeepBelow.
Definition: knoteconfig.h:312
KNoteUtils::sendToNetwork
KNOTES_EXPORT void sendToNetwork(QWidget *parent, const QString &title, const QString &message)
Definition: knoteutils.cpp:153
KNoteConfig::keepBelow
bool keepBelow() const
Get KeepBelow.
Definition: knoteconfig.h:321
KNote::sigNameChanged
void sigNameChanged(const QString &)
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:56:33 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

knotes

Skip menu "knotes"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal