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

mainwindow.h

Go to the documentation of this file.
00001 /*
00002                              This file is part of the Opie Project
00003 
00004                              Copyright (C) Opie Team <opie-devel@handhelds.org>
00005               =.
00006             .=l.
00007            .>+-=
00008  _;:,     .>    :=|.         This program is free software; you can
00009 .> <`_,   >  .   <=          redistribute it and/or  modify it under
00010 :`=1 )Y*s>-.--   :           the terms of the GNU Library General Public
00011 .="- .-=="i,     .._         License as published by the Free Software
00012  - .   .-<_>     .<>         Foundation; either version 2 of the License,
00013      ._= =}       :          or (at your option) any later version.
00014     .%`+i>       _;_.
00015     .i_,=:_.      -<s.       This program is distributed in the hope that
00016      +  .  -:.       =       it will be useful,  but WITHOUT ANY WARRANTY;
00017     : ..    .:,     . . .    without even the implied warranty of
00018     =_        +     =;=|`    MERCHANTABILITY or FITNESS FOR A
00019   _.=:.       :    :=>`:     PARTICULAR PURPOSE. See the GNU
00020 ..}^=.=       =       ;      Library General Public License for more
00021 ++=   -.     .`     .:       details.
00022 :     =  ...= . :.=-
00023  -.   .:....=;==+<;          You should have received a copy of the GNU
00024   -_. . .   )=.  =           Library General Public License along with
00025     --        :-=`           this library; see the file COPYING.LIB.
00026                              If not, write to the Free Software Foundation,
00027                              Inc., 59 Temple Place - Suite 330,
00028                              Boston, MA 02111-1307, USA.
00029 */
00030 
00031 #ifndef TODO_MAIN_WINDOW_H
00032 #define TODO_MAIN_WINDOW_H
00033 
00034 #include <qlist.h>
00035 
00036 #include <opie2/otodoaccess.h>
00037 #include <opie2/opimtodo.h>
00038 #include <opie2/opimmainwindow.h>
00039 #include <opie2/owidgetstack.h>
00040 
00041 #include "smalltodo.h"
00042 #include "todoview.h"
00043 #include "quickedit.h"
00044 #include "todomanager.h"
00045 
00046 class QPopupMenu;
00047 class QMenuBar;
00048 class QToolBar;
00049 class QAction;
00050 class Ir;
00051 class QVBox;
00052 class QLineEdit;
00053 
00054 namespace Todo {
00055     typedef TodoView View;
00056     class TemplateManager;
00057     class Editor;
00058     class TodoShow;
00059     struct QuickEditBase;
00060 
00061     class MainWindow : public Opie::OPimMainWindow {
00062         Q_OBJECT
00063         friend class TodoView; // avoid QObject here....
00064         friend class TodoShow; // avoid QObject
00065     public:
00066         /* Opie::Core::OApplicationFactory application Name */
00067         static QString appName() { return QString::fromLatin1("todolist"); }
00068 
00069         MainWindow( QWidget *parent = 0,
00070                     const char* name = 0, WFlags fl = 0 );
00071         ~MainWindow();
00072 
00074         QPopupMenu* contextMenu(int uid, bool doesRecur = FALSE );
00075 
00076         void updateList();
00077         OPimTodoAccess::List list()const;
00078         OPimTodoAccess::List sorted( bool asc, int sortOrder );
00079         OPimTodoAccess::List sorted( bool asc, int sortOrder, int addFilter );
00080 
00081         OPimTodo event(int uid );
00082 
00083         bool isSyncing()const;
00084         bool showCompleted()const;
00085         bool showDeadline()const;
00086         bool showOverDue()const;
00087         bool showQuickTask()const;
00088         QString currentCategory()const;
00089         int currentCatId();
00090         TemplateManager* templateManager();
00091         QuickEditBase* quickEditor();
00092 
00093         void updateTodo( const OPimTodo& );
00094         Editor* currentEditor();
00095         void setReadAhead(uint count );
00096 private slots:
00097         void slotQuickEntered();
00098         void slotReload();
00099         void slotFlush();
00100 
00101     protected:
00102         void closeEvent( QCloseEvent* e );
00103 
00104     private:
00105         /* handle setting and removing alarms */
00106         void handleAlarms( const OPimTodo& oldTodo, const OPimTodo& newTodo );
00107         void receiveFile( const QString& filename );
00108         void connectBase( ViewBase* );
00109         void initUI();
00110         void initActions();
00111         void initConfig();
00112         void initViews();
00113         void initEditor();
00114         void initShow();
00115         void raiseCurrentView();
00116         ViewBase* currentView();
00117         ViewBase* m_curView;
00118         bool m_showing : 1; // used to see if we show a todo in the cases we shouldn't change the table
00119         QuickEditBase* m_curQuick;
00120         Editor* m_curEdit;
00121         TodoShow* currentShow();
00122         TodoShow* m_curShow;
00123 
00124         QAction* m_editAction,
00125             *m_deleteAction,
00126             *m_findAction,
00127             *m_completedAction,
00128             *m_showDeadLineAction,
00129             *m_deleteAllAction,
00130             *m_deleteCompleteAction,
00131             *m_duplicateAction,
00132             *m_showOverDueAction,
00133             *m_showQuickTaskAction,
00134             *m_effectiveAction;
00135         Opie::Ui::OWidgetStack *m_stack;
00136 
00137         bool m_syncing:1;
00138         bool m_deadline:1;
00139         bool m_completed:1;
00140         bool m_overdue:1;
00141         bool m_quicktask:1;
00142         TodoManager m_todoMgr;
00143         QString m_curCat;
00144         QList<ViewBase> m_views;
00145         uint m_counter;
00146         TemplateManager* m_tempManager;
00147 
00148 
00149      private slots:
00150         void initStuff();
00151 
00152         void slotItemNew();
00153         void slotItemEdit();
00154         void slotItemDuplicate();
00155         void slotItemDelete();
00156         void slotItemBeam();
00157         void slotItemFind();
00158         void slotConfigure();
00159 
00160         void slotShow(int);
00161         void slotEdit(int);
00162         void slotUpdate3( QWidget* );
00163         void slotComplete( int uid );
00164         void slotComplete( const OPimTodo& ev );
00165 
00166         void slotDelete(int uid );
00167         void slotDeleteAll();
00168         void slotDeleteCompleted();
00169 
00170 
00171         void setCategory( const QString &category );
00172 
00173         void slotShowDeadLine( bool );
00174         void slotShowCompleted( bool );
00175         void slotShowQuickTask( bool );
00176 
00177         void setDocument( const QString& );
00178 
00179 
00180         void beamDone( Ir* );
00181         void slotShowDetails();
00182         void slotShowNext();
00183         void slotShowPrev();
00184         void slotShowDue( bool );
00185         void slotReturnFromView(); // for TodoShow...
00186         /* reimplementation from opimmainwindow */
00187     protected slots:
00188         void flush();
00189         void reload();
00190         int create();
00191         bool remove( int uid );
00192         void beam(int uid);
00193         void show( int uid );
00194         void edit( int uid );
00195         void add( const Opie::OPimRecord& );
00196         void doAlarm( const QDateTime& dt, int uid );
00197     };
00198 }
00199 
00200 #endif

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