kexi

kexibrowser.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2002, 2003 Lucijan Busch <lucijan@gmx.at>
00003    Copyright (C) 2003-2006 Jaroslaw Staniek <js@iidea.pl>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library 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 library 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    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018  * Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #ifndef KEXIBROWSER_H
00022 #define KEXIBROWSER_H
00023 
00024 #include <klistview.h>
00025 #include <qasciidict.h>
00026 #include <qintdict.h>
00027 
00028 class QListViewItem;
00029 class KIconLoader;
00030 class KPopupMenu;
00031 class KAction;
00032 class KActionMenu;
00033 class KActionCollection;
00034 class KListView;
00035 class KToolBar;
00036 class KexiBrowserItem;
00037 class KexiView;
00038 class KexiMainWindow;
00039 class KexiSmallToolButton;
00040 class KexiBrowserListView;
00041 
00042 namespace KexiPart
00043 {
00044     class Info;
00045     class Item;
00046     class Part;
00047 }
00048 class KexiProject;
00049 
00051 class KEXIEXTWIDGETS_EXPORT KexiBrowser : public QWidget
00052 {
00053     Q_OBJECT
00054 
00055     public:
00056         enum Features {
00057             Writable = 1, 
00058             ContextMenus = 2, 
00059             Toolbar = 4, 
00060             SingleClickOpensItemOptionEnabled = 8, 
00061             DefaultFeatures = Writable | ContextMenus | Toolbar 
00062                 | SingleClickOpensItemOptionEnabled 
00063         };
00064 
00065         KexiBrowser(QWidget* parent, KexiMainWindow *mainWin, int features = DefaultFeatures);
00066         virtual ~KexiBrowser(); 
00067 
00074         void setProject(KexiProject* prj, const QString& itemsMimeType = QString::null, 
00075             QString* partManagerErrorMessages = 0);
00076 
00080         QString itemsMimeType() const;
00081 
00082         KexiPart::Item* selectedPartItem() const;
00083 
00084         void installEventFilter ( const QObject * filterObj );
00085         virtual bool eventFilter ( QObject *o, QEvent * e );
00086 
00087         bool actionEnabled(const QCString& actionName) const;
00088 
00089     public slots:
00090         KexiBrowserItem* addGroup(KexiPart::Info& info);
00091         KexiBrowserItem* addItem(KexiPart::Item& item);
00092         void slotRemoveItem(const KexiPart::Item &item);
00093         virtual void setFocus();
00094         void updateItemName(KexiPart::Item& item, bool dirty);
00095         void selectItem(KexiPart::Item& item);
00096         void clearSelection();
00097         void clear();
00098 
00101         void setReadOnly(bool set);
00102 
00103         bool isReadOnly() const;
00104 
00105     signals: 
00106         void openItem( KexiPart::Item*, int viewMode );
00107 
00112         void openOrActivateItem( KexiPart::Item*, int viewMode );
00113 
00114         void newItem( KexiPart::Info* );
00115 
00116         void removeItem( KexiPart::Item* );
00117 
00118         void renameItem( KexiPart::Item *item, const QString& _newName, bool &succes );
00119 
00120         void selectionChanged( KexiPart::Item* item );
00121 
00122         void executeItem( KexiPart::Item* );
00123 
00124         void exportItemAsDataTable( KexiPart::Item* );
00125 
00126         void printItem( KexiPart::Item* );
00127 
00128         void pageSetupForItem( KexiPart::Item* );
00129 
00130     protected slots:
00131         void slotContextMenu(KListView*, QListViewItem *i, const QPoint &point);
00132         void slotExecuteItem(QListViewItem *item);
00133         void slotSelectionChanged(QListViewItem* i);
00134         void slotSettingsChanged(int);
00135         void slotNewObjectPopupAboutToShow();
00136 
00137         void slotNewObject();
00138         void slotOpenObject();
00139         void slotDesignObject();
00140         void slotEditTextObject();
00141         void slotRemove();
00142         void slotCut();
00143         void slotCopy();
00144         void slotPaste();
00145         void slotRename();
00146         void slotExecuteObject();
00147         void slotExportAsDataTable();
00148         void slotPrintItem();
00149         void slotPageSetupForItem();
00150 
00151     protected:
00152         void itemRenameDone();
00153         KexiBrowserItem* addItem(KexiPart::Item& item, KexiBrowserItem *parent, KexiPart::Info* info);
00154 
00155         KexiMainWindow *m_mainWin;
00156         int m_features;
00157         KexiBrowserListView *m_list;
00158         KActionCollection *m_actions;
00159         QAsciiDict<KexiBrowserItem> m_baseItems;
00160         QIntDict<KexiBrowserItem> m_normalItems;
00161         KPopupMenu *m_itemPopup, *m_partPopup;
00162         KAction *m_deleteAction, *m_renameAction, 
00163             *m_newObjectAction, // *m_newObjectToolbarAction,
00164             *m_openAction, *m_designAction, *m_editTextAction,
00165             *m_executeAction,
00166             *m_dataExportAction, *m_printAction, *m_pageSetupAction;
00167         KActionMenu* m_exportActionMenu;
00168         KPopupMenu* m_newObjectPopup;
00169         int m_itemPopupTitle_id, m_partPopupTitle_id, 
00170             m_openAction_id, m_designAction_id, m_editTextAction_id,
00171             m_executeAction_id,
00172             m_exportActionMenu_id, m_exportActionMenu_id_sep,
00173             m_printAction_id, m_pageSetupAction_id, m_pageSetupAction_id_sep;
00174 
00175         KexiPart::Part *m_prevSelectedPart;
00176         KToolBar *m_toolbar;
00177         KexiSmallToolButton *m_newObjectToolButton, *m_deleteObjectToolButton;
00178         QString m_itemsMimeType;
00179         bool m_singleClick : 1;
00180         bool m_readOnly : 1;
00181 };
00182 
00183 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys