kpilot
dbviewerWidget.h
Go to the documentation of this file.00001 #ifndef _KPILOT_DBVIEWERWIDGET_H 00002 #define _KPILOT_DBVIEWERWIDGET_H 00003 /* dbViewerWidget.h KPilot 00004 ** 00005 ** Copyright (C) 2003 by Dan Pilone. 00006 ** Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com> 00007 ** Written 2003 by Reinhold Kainhofer and Adriaan de Groot 00008 ** 00009 ** This is the generic DB viewer widget. 00010 */ 00011 00012 /* 00013 ** This program is free software; you can redistribute it and/or modify 00014 ** it under the terms of the GNU General Public License as published by 00015 ** the Free Software Foundation; either version 2 of the License, or 00016 ** (at your option) any later version. 00017 ** 00018 ** This program is distributed in the hope that it will be useful, 00019 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 00020 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00021 ** GNU General Public License for more details. 00022 ** 00023 ** You should have received a copy of the GNU General Public License 00024 ** along with this program in a file called COPYING; if not, write to 00025 ** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 00026 ** MA 02110-1301, USA. 00027 */ 00028 00029 /* 00030 ** Bug reports and questions can be sent to kde-pim@kde.org 00031 */ 00032 00033 #include "pilotComponent.h" 00034 00035 class KListBox; 00036 class KTextEdit; 00037 class KPushButton; 00038 class KComboBox; 00039 class PilotLocalDatabase; 00040 class PilotRecord; 00041 class KListView; 00042 00043 class GenericDBWidget : public PilotComponent 00044 { 00045 Q_OBJECT 00046 00047 public: 00048 GenericDBWidget(QWidget* parent, const QString& dbpath); 00049 virtual ~GenericDBWidget(); 00050 00051 // Pilot component methods 00052 /* virtual */ void showComponent(); 00053 /* virtual */ void hideComponent(); 00054 00055 QString getCurrentDB() const { return currentDB; } 00056 protected: 00057 void setupWidget(); 00058 00059 protected slots: 00060 void slotSelected(const QString &dbname); 00061 void slotDBType(int mode); 00062 void reset(); 00063 void slotAddRecord(); 00064 void slotEditRecord(); 00065 bool slotEditRecord(QListViewItem*); 00066 void slotDeleteRecord(); 00067 void slotShowAppInfo(); 00068 void slotShowDBInfo(); 00069 void enableWidgets(bool enable); 00070 void writeRecord(PilotRecord*r); 00071 00072 private: 00073 KListBox*fDBList; 00074 KComboBox*fDBType; 00075 KTextEdit*fDBInfo; 00076 KPushButton*fDBInfoButton, *fAppInfoButton; 00077 KListView*fRecordList; 00078 KPushButton*fAddRecord, *fEditRecord, *fDeleteRecord; 00079 00080 enum eDBType { 00081 eDatabase, 00082 eApplication 00083 } currentDBtype; 00084 00085 PilotLocalDatabase*fDB; 00086 QString currentDB; 00087 QPtrList<PilotRecord> fRecList; 00088 }; 00089 00090 00091 #endif