kontact Library API Documentation

knotes_part_p.h

00001 /* 00002 This file is part of the KDE project 00003 Copyright (C) 2004 Michael Brade <brade@kde.org> 00004 00005 This program is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 General Public License for more details. 00014 00015 You should have received a copy of the GNU General Public License 00016 along with this program; see the file COPYING. If not, write to 00017 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00018 Boston, MA 02111-1307, USA. 00019 00020 In addition, as a special exception, the copyright holders give 00021 permission to link the code of this program with any edition of 00022 the Qt library by Trolltech AS, Norway (or with modified versions 00023 of Qt that use the same license as Qt), and distribute linked 00024 combinations including the two. You must obey the GNU General 00025 Public License in all respects for all of the code used other than 00026 Qt. If you modify this file, you may extend this exception to 00027 your version of the file, but you are not obligated to do so. If 00028 you do not wish to do so, delete this exception statement from 00029 your version. 00030 */ 00031 00032 #ifndef KNOTES_PART_P_H 00033 #define KNOTES_PART_P_H 00034 00035 #include <qlayout.h> 00036 00037 #include <kactioncollection.h> 00038 #include <klocale.h> 00039 #include <kiconview.h> 00040 #include <kglobal.h> 00041 #include <kiconloader.h> 00042 #include <ktoolbar.h> 00043 #include <kpopupmenu.h> 00044 #include <kdialogbase.h> 00045 #include <kxmlguiclient.h> 00046 #include <kxmlguifactory.h> 00047 #include <kxmlguibuilder.h> 00048 00049 #include <libkcal/journal.h> 00050 00051 #include "knotes/knoteedit.h" 00052 00053 00054 class KNotesIconViewItem : public KIconViewItem 00055 { 00056 public: 00057 KNotesIconViewItem( KIconView *parent, KCal::Journal *journal ) 00058 : KIconViewItem( parent ), 00059 m_journal( journal ) 00060 { 00061 setRenameEnabled( true ); 00062 00063 setPixmap( KGlobal::iconLoader()->loadIcon( "knotes", KIcon::Desktop ) ); 00064 setText( journal->summary() ); 00065 } 00066 00067 KCal::Journal *journal() 00068 { 00069 return m_journal; 00070 } 00071 00072 virtual void setText( const QString & text ) 00073 { 00074 KIconViewItem::setText( text ); 00075 m_journal->setSummary( text ); 00076 } 00077 00078 virtual QString text() const 00079 { 00080 return m_journal->summary(); 00081 } 00082 00083 private: 00084 KCal::Journal *m_journal; 00085 }; 00086 00087 00088 class KNoteEditDlg : public KDialogBase, virtual public KXMLGUIClient 00089 { 00090 Q_OBJECT 00091 public: 00092 KNoteEditDlg( QWidget *parent = 0, const char *name = 0 ) 00093 : KDialogBase( Plain, i18n("Edit Note"), Ok|Cancel, Ok, parent, name, true, true ) 00094 { 00095 // this dialog is modal to prevent one from editing the same note twice in two 00096 // different windows 00097 00098 setInstance( new KInstance( "knotes" ) ); // TODO: hm, memleak?? 00099 setXMLFile( "knotesui.rc" ); 00100 actionCollection()->setWidget( this ); 00101 00102 QWidget *page = plainPage(); 00103 QVBoxLayout *layout = new QVBoxLayout( page ); 00104 00105 m_noteEdit = new KNoteEdit( actionCollection(), page ); 00106 m_noteEdit->setFocus(); 00107 00108 KXMLGUIBuilder builder( page ); 00109 KXMLGUIFactory factory( &builder, this ); 00110 factory.addClient( this ); 00111 00112 m_tool = static_cast<KToolBar *>(factory.container( "note_tool", this )); 00113 00114 layout->addWidget( m_tool ); 00115 layout->addWidget( m_noteEdit ); 00116 } 00117 00118 QString text() const 00119 { 00120 return m_noteEdit->text(); 00121 } 00122 00123 void setText( const QString& text ) 00124 { 00125 m_noteEdit->setText( text ); 00126 } 00127 00128 private: 00129 KNoteEdit *m_noteEdit; 00130 KToolBar *m_tool; 00131 KPopupMenu *m_edit_menu; 00132 }; 00133 00134 00135 #endif
KDE Logo
This file is part of the documentation for kontact Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Oct 21 19:47:00 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003