kpilot

memoWidget.h

Go to the documentation of this file.
00001 #ifndef _KPILOT_MEMOWIDGET_H
00002 #define _KPILOT_MEMOWIDGET_H
00003 /* memoWidget.h         KPilot
00004 **
00005 ** Copyright (C) 1998-2001 by Dan Pilone
00006 **
00007 ** This is the memo viewer widget.
00008 */
00009 
00010 /*
00011 ** This program is free software; you can redistribute it and/or modify
00012 ** it under the terms of the GNU General Public License as published by
00013 ** the Free Software Foundation; either version 2 of the License, or
00014 ** (at your option) any later version.
00015 **
00016 ** This program is distributed in the hope that it will be useful,
00017 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00018 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00019 ** GNU General Public License for more details.
00020 **
00021 ** You should have received a copy of the GNU General Public License
00022 ** along with this program in a file called COPYING; if not, write to
00023 ** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
00024 ** MA 02110-1301, USA.
00025 */
00026 
00027 /*
00028 ** Bug reports and questions can be sent to kde-pim@kde.org
00029 */
00030 
00031 #include "pilotComponent.h"
00032 
00033 class KPilotInstaller;
00034 class QListBox;
00035 class QComboBox;
00036 class QPushButton;
00037 class KTextEdit;
00038 
00039 class PilotMemo;
00040 class PilotListItem;
00041 
00042 class MemoWidget : public PilotComponent
00043 {
00044 Q_OBJECT
00045 
00046 public:
00047     MemoWidget(QWidget* parent, const QString& dbpath);
00048     virtual ~MemoWidget();
00049 
00050     // Pilot Component Methods:
00051     /* virtual */ void showComponent();
00052     /* virtual */ void hideComponent();
00053     /* virtual */ bool preHotSync(QString &);
00054     /* virtual */ void postHotSync();
00055 
00056     // Added by David Bishop, please move to correct location!
00057     bool saveAsXML(const QString &fileName,const QPtrList<PilotListItem> &menu_item );
00058     bool saveAsText(const QString &fileName,const QPtrList<PilotListItem> &menu_item );
00059 
00060     typedef enum {
00061         MAX_MEMO_LEN = 8192
00062         } Constants ;
00063 
00064 protected:
00065     void initializeCategories(PilotDatabase *);
00066     void initializeMemos(PilotDatabase *);
00067 
00068     void saveChangedMemo();
00069 
00070     bool addMemo(const QString &text, int category);
00071 
00072 public slots:
00080     void slotShowMemo(int);
00081     void slotUpdateButtons();
00082 
00083     void slotImportMemo();
00084     void slotExportMemo();
00085     void slotDeleteMemo();
00086     void slotAddMemo();
00087     void slotSetCategory(int);
00088 
00089 protected:
00090     void showMemo(const PilotMemo *);
00091 
00092 
00093 private:
00094     void setupWidget();
00095     void updateWidget(); // Called with the lists have changed..
00096     void writeMemo(PilotMemo* which);
00097 
00098     class Private;
00099 
00100     QComboBox* fCatList;
00101 
00102     KTextEdit*      fTextWidget;
00103     Private *d;
00104     QListBox*       fListBox;
00105 
00106     QPushButton *fExportButton,*fDeleteButton;
00107 
00108     int lastSelectedMemo;
00109 };
00110 
00111 
00112 #endif