Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

opimmainwindow.h

Go to the documentation of this file.
00001 /*
00002                              This file is part of the Opie Project
00003                              Copyright (C) Stefan Eilers (Eilers.Stefan@epost.de)
00004               =.             Copyright (C) The Opie Team <opie-devel@handhelds.org>
00005             .=l.
00006            .>+-=
00007  _;:,     .>    :=|.         This program is free software; you can
00008 .> <`_,   >  .   <=          redistribute it and/or  modify it under
00009 :`=1 )Y*s>-.--   :           the terms of the GNU Library General Public
00010 .="- .-=="i,     .._         License as published by the Free Software
00011  - .   .-<_>     .<>         Foundation; either version 2 of the License,
00012      ._= =}       :          or (at your option) any later version.
00013     .%`+i>       _;_.
00014     .i_,=:_.      -<s.       This program is distributed in the hope that
00015      +  .  -:.       =       it will be useful,  but WITHOUT ANY WARRANTY;
00016     : ..    .:,     . . .    without even the implied warranty of
00017     =_        +     =;=|`    MERCHANTABILITY or FITNESS FOR A
00018   _.=:.       :    :=>`:     PARTICULAR PURPOSE. See the GNU
00019 ..}^=.=       =       ;      Library General Public License for more
00020 ++=   -.     .`     .:       details.
00021  :     =  ...= . :.=-
00022  -.   .:....=;==+<;          You should have received a copy of the GNU
00023   -_. . .   )=.  =           Library General Public License along with
00024     --        :-=`           this library; see the file COPYING.LIB.
00025                              If not, write to the Free Software Foundation,
00026                              Inc., 59 Temple Place - Suite 330,
00027                              Boston, MA 02111-1307, USA.
00028 */
00029 #ifndef OPIE_PIM_MAINWINDOW_H
00030 #define OPIE_PIM_MAINWINDOW_H
00031 
00032 #include <opie2/opimrecord.h>
00033 
00034 #include <qpe/categories.h>
00035 #include <qpe/config.h>
00036 
00037 #include <qmainwindow.h>
00038 
00039 class QAction;
00040 class QActionGroup;
00041 class QComboBox;
00042 class QCopChannel;
00043 class QDateTime;
00044 class QPopupMenu;
00045 
00046 namespace Opie {
00053 /*
00054  * due Qt and Templates with signal and slots
00055  * do not work that good :(
00056  * (Ok how to moc a template ;) )
00057  * We will have the mainwindow which calls a struct which
00058  * is normally reimplemented as a template ;)
00059  */
00060 
00061 class OPimMainWindow : public QMainWindow {
00062     Q_OBJECT
00063 public:
00064     enum TransPort { BlueTooth=0,
00065                      IrDa };
00066 
00067     OPimMainWindow( const QString &serviceName,
00068                     const QString &catName = QString::null,
00069                     const QString &itemName = QString::null,
00070                     const QString &configName = QString::null,
00071                     QWidget *parent = 0l,  const char* name = 0l, WFlags f = WType_TopLevel );
00072     virtual ~OPimMainWindow();
00073 
00074 
00075 protected slots:
00076     /*
00077      * called when a setDocument
00078      * couldn't be handled by this window
00079      */
00080     virtual void doSetDocument( const QString& );
00081     /* for syncing */
00082     virtual void flush()  = 0;
00083     virtual void reload() = 0;
00084 
00086     virtual int create() = 0;
00088     virtual bool remove( int uid ) = 0;
00090     virtual void beam( int uid ) = 0;
00091 
00093     virtual void show( int uid ) = 0;
00095     virtual void edit( int uid ) = 0;
00096 
00098     virtual void add( const OPimRecord& ) = 0;
00099 
00100     virtual void doAlarm( const QDateTime&, int uid );
00101 
00102     QCopChannel* channel();
00103 
00105     virtual void slotItemNew() = 0;
00106     virtual void slotItemEdit() = 0;
00107     virtual void slotItemDuplicate() = 0;
00108     virtual void slotItemDelete() = 0;
00109     virtual void slotItemBeam() = 0;
00110     virtual void slotConfigure() = 0;
00111 
00112 protected:
00117     void startAlarm( int count = 10 );
00118     void killAlarm();
00119     void timerEvent( QTimerEvent* );
00120 
00122     QPopupMenu *itemContextMenu();
00123 
00124     void insertItemMenuItems( QActionGroup *items );
00125     void insertViewMenuItems( QActionGroup *items );
00126 
00127     void setViewCategory( const QString &category );
00128     void reloadCategories();
00129 
00130     void setItemNewEnabled( bool enable );
00131     void setItemEditEnabled( bool enable );
00132     void setItemDuplicateEnabled( bool enable );
00133     void setItemDeleteEnabled( bool enable );
00134     void setItemBeamEnabled( bool enable );
00135     void setConfigureEnabled( bool enable );
00136     void setShowCategories( bool show );
00137 
00138 private slots:
00139     void appMessage( const QCString&, const QByteArray& );
00140     void setDocument( const QString& );
00141 
00142 private:
00143     class Private;
00144     Private* d;
00145 
00146     int m_rtti;
00147     QCopChannel* m_channel;
00148     QString m_service;
00149     QCString m_str;
00150     OPimRecord* m_fallBack;
00151     int m_alarmCount;
00152     int m_playedCount;
00153     int m_timerId;
00154 
00155     QString    m_catGroupName; // Name of category group
00156     Config     m_config;       // Configuration settings file
00157 
00158     // Menu bar data
00159     QPopupMenu   *m_itemContextMenu;     // Pointer to context-sensitive menu
00160     QPopupMenu   *m_itemMenu;            // Pointer to item menu
00161     QPopupMenu   *m_viewMenu;            // Pointer to view menu
00162     QActionGroup *m_itemMenuGroup1;      // Action group containing default items in Item menu
00163     QActionGroup *m_itemMenuGroup2;      // Action group containing default items in Item menu
00164     QActionGroup *m_viewMenuAppGroup;    // Action group containing application items in View menu
00165 //    QActionGroup *m_viewMenuGroup;       // Action group containing default items in View menu
00166     QAction      *m_itemNewAction;       // Add new item action
00167     QAction      *m_itemEditAction;      // Edit current item action
00168     QAction      *m_itemDuplicateAction; // Duplicate current item action
00169     QAction      *m_itemDeleteAction;    // Delete current item action
00170     QAction      *m_itemBeamAction;      // Beam current item action
00171     QAction      *m_configureAction;     // Configure application dialog action
00172 
00173     QComboBox    *m_catSelect;           // Category selection combo box
00174 
00175     /* I would love to do this as a template
00176      * but can't think of a right way
00177      * because I need signal and slots -zecke
00178      */
00179     virtual OPimRecord* record( int rtti, const QByteArray& ) ;
00180     int service();
00181 
00183     void initBars( const QString &itemName = tr( "Item" ) );
00184 
00185 signals:
00186     void categorySelected( const QString &cat );
00187 };
00188 
00189 }
00190 
00191 #endif

Generated on Sat Nov 5 16:16:23 2005 for OPIE by  doxygen 1.4.2