author | zecke <zecke> | 2003-08-27 13:12:10 (UTC) |
---|---|---|
committer | zecke <zecke> | 2003-08-27 13:12:10 (UTC) |
commit | e2cbbacc147897a7db1dfe7335397ce980b295cc (patch) (side-by-side diff) | |
tree | 6afbc52fdf2ca5912d20a47eed08141668824782 | |
parent | 2635bf400cb58c11f48477150d6fc4337de12fb0 (diff) | |
download | opie-e2cbbacc147897a7db1dfe7335397ce980b295cc.zip opie-e2cbbacc147897a7db1dfe7335397ce980b295cc.tar.gz opie-e2cbbacc147897a7db1dfe7335397ce980b295cc.tar.bz2 |
-Convert to quick launch as an example
-Fix a bug. If flush() is called m_syncing = true and on reload m_syncing = false
-rw-r--r-- | core/pim/todo/mainwindow.cpp | 10 | ||||
-rw-r--r-- | core/pim/todo/mainwindow.h | 5 | ||||
-rw-r--r-- | core/pim/todo/todo.pro | 28 |
3 files changed, 15 insertions, 28 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp index 6725951..ecb4e40 100644 --- a/core/pim/todo/mainwindow.cpp +++ b/core/pim/todo/mainwindow.cpp @@ -33,62 +33,65 @@ #include <qtoolbar.h> #include <qpopupmenu.h> #include <qpushbutton.h> #include <qwidgetstack.h> #include <qaction.h> #include <qtimer.h> #include <qvbox.h> #include <qlayout.h> #include <qlineedit.h> #include <qwhatsthis.h> #include <qpe/applnk.h> #include <qpe/config.h> #include <qpe/ir.h> #include <qpe/resource.h> #include <qpe/qpemessagebox.h> #include <qpe/alarmserver.h> #include <qpe/timestring.h> #include <qpe/qpeapplication.h> #include <opie/orecur.h> #include <opie/opimnotifymanager.h> #include <opie/otodoaccessvcal.h> +#include <opie/oapplicationfactory.h> + #include "quickeditimpl.h" #include "todotemplatemanager.h" #include "templateeditor.h" #include "tableview.h" #include "textviewshow.h" #include "todoeditor.h" #include "mainwindow.h" +OPIE_EXPORT_APP( OApplicationFactory<Todo::MainWindow> ) using namespace Todo; MainWindow::MainWindow( QWidget* parent, - const char* name ) + const char* name, WFlags ) : OPimMainWindow( "Todolist", parent, name, WType_TopLevel | WStyle_ContextHelp ) { m_syncing = false; m_showing = false; m_counter = 0; m_tempManager = new TemplateManager(); m_tempManager->load(); initUI(); initConfig(); initViews(); initActions(); initEditor(); initShow(); initTemplate(); populateTemplates(); raiseCurrentView(); QTimer::singleShot(0, this, SLOT(populateCategories() ) ); } void MainWindow::initTemplate() { m_curTempEd = new TemplateEditor( this, templateManager() ); } void MainWindow::initActions() { @@ -329,48 +332,49 @@ OTodoAccess::List MainWindow::sorted( bool asc, int sortOrder, int addFilter) { if ( m_curCat != QWidget::tr("All Categories") ) cat = currentCatId(); if ( m_curCat == QWidget::tr("Unfiled") ) cat = -1; return m_todoMgr.sorted(asc, sortOrder, addFilter, cat ); } OTodo MainWindow::event( int uid ) { return m_todoMgr.event( uid ); } bool MainWindow::isSyncing()const { return m_syncing; } TemplateManager* MainWindow::templateManager() { return m_tempManager; } Editor* MainWindow::currentEditor() { return m_curEdit; } TodoShow* MainWindow::currentShow() { return m_curShow; } void MainWindow::slotReload() { + m_syncing = FALSE; m_todoMgr.reload(); currentView()->updateView( ); raiseCurrentView(); } void MainWindow::closeEvent( QCloseEvent* e ) { if (m_stack->visibleWidget() == currentShow()->widget() ) { m_showing = false; raiseCurrentView(); e->ignore(); return; } /* * we should have flushed and now we're still saving * so there is no need to flush */ if (m_syncing ) { e->accept(); return; } bool quit = false; if ( m_todoMgr.saveAll() ){ qWarning("saved"); quit = true; }else { @@ -583,56 +587,56 @@ static const char *beamfile = "/tmp/opie-todo.vcs"; void MainWindow::slotBeam() { beam( currentView()->current() ); } void MainWindow::beamDone( Ir* ir) { delete ir; ::unlink( beamfile ); } void MainWindow::receiveFile( const QString& filename ) { OTodoAccessVCal* cal = new OTodoAccessVCal(filename ); OTodoAccess acc( cal ); acc.load(); OTodoAccess::List list = acc.allRecords(); if (list.count()){ QString message = QWidget::tr("<P>%1 new tasks arrived.<p>Would you like to add them to your Todolist?").arg(list.count() ); if ( QMessageBox::information(this, QWidget::tr("New Tasks"), message, QMessageBox::Ok, QMessageBox::Cancel ) == QMessageBox::Ok ) { OTodoAccess::List::Iterator it; for ( it = list.begin(); it != list.end(); ++it ) m_todoMgr.add( (*it) ); - + currentView()->updateView(); } } } void MainWindow::slotFlush() { - m_syncing = FALSE; + m_syncing = TRUE; m_todoMgr.save(); } void MainWindow::slotShowDetails() { slotShow( currentView()->current() ); } /* * populate the Categories * Menu */ void MainWindow::populateCategories() { m_todoMgr.load(); m_catMenu->clear(); int id, rememberId; id = 1; rememberId = 1; m_catMenu->insertItem( QWidget::tr( "All Categories" ), id++ ); m_catMenu->insertSeparator(); QStringList categories = m_todoMgr.categories(); categories.append( QWidget::tr( "Unfiled" ) ); for ( QStringList::Iterator it = categories.begin(); it != categories.end(); ++it ) { m_catMenu->insertItem( *it, id ); diff --git a/core/pim/todo/mainwindow.h b/core/pim/todo/mainwindow.h index b04a958..bd341c2 100644 --- a/core/pim/todo/mainwindow.h +++ b/core/pim/todo/mainwindow.h @@ -41,50 +41,53 @@ #include "todomanager.h" class QPopupMenu; class QMenuBar; class QToolBar; class QAction; class QWidgetStack; class Ir; class QVBox; class QLineEdit; namespace Todo { typedef TodoView View; class TemplateManager; class Editor; class TodoShow; class TemplateEditor; struct QuickEditBase; class MainWindow : public OPimMainWindow { Q_OBJECT friend class TodoView; // avoid QObject here.... friend class TodoShow; // avoid QObject public: + /* OApplicationFactory application Name */ + static QString appName() { return QString::fromLatin1("todolist"); } + MainWindow( QWidget *parent = 0, - const char* name = 0 ); + const char* name = 0, WFlags fl = 0 ); ~MainWindow(); /** return a context menu for an OTodo */ QPopupMenu* contextMenu(int uid, bool doesRecur = FALSE ); QPopupMenu* options(); QPopupMenu* edit(); QToolBar* toolbar(); void updateList(); OTodoAccess::List list()const; OTodoAccess::List sorted( bool asc, int sortOrder ); OTodoAccess::List sorted( bool asc, int sortOrder, int addFilter ); OTodo event(int uid ); bool isSyncing()const; bool showCompleted()const; bool showDeadline()const; bool showOverDue()const; bool showQuickTask()const; QString currentCategory()const; int currentCatId(); TemplateManager* templateManager(); diff --git a/core/pim/todo/todo.pro b/core/pim/todo/todo.pro index 4a63770..51cfde7 100644 --- a/core/pim/todo/todo.pro +++ b/core/pim/todo/todo.pro @@ -1,69 +1,49 @@ -TEMPLATE = app -CONFIG = qt warn_on release -DESTDIR = $(OPIEDIR)/bin +#TEMPLATE = app +CONFIG = qt warn_on release quick-app +#DESTDIR = $(OPIEDIR)/bin HEADERS = smalltodo.h \ todomanager.h \ mainwindow.h \ todoview.h \ tableview.h \ todotemplatemanager.h \ todoeditor.h \ todoshow.h \ textviewshow.h \ templateeditor.h \ templatedialog.h \ templatedialogimpl.h \ quickedit.h \ quickeditimpl.h \ otaskeditor.h \ taskeditoroverview.h \ taskeditorstatus.h \ taskeditoralarms.h SOURCES = smalltodo.cpp \ todomanager.cpp \ mainwindow.cpp \ - main.cpp \ +# main.cpp \ tableview.cpp \ todoview.cpp \ todotemplatemanager.cpp \ todoeditor.cpp \ todoshow.cpp \ textviewshow.cpp \ templateeditor.cpp \ templatedialog.cpp \ templatedialogimpl.cpp \ quickeditimpl.cpp \ quickedit.cpp \ otaskeditor.cpp \ taskeditoroverview.cpp \ taskeditorstatus.cpp \ taskeditoralarms.cpp TARGET = todolist INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe -lopie -TRANSLATIONS = ../../../i18n/de/todolist.ts \ - ../../../i18n/nl/todolist.ts \ - ../../../i18n/da/todolist.ts \ - ../../../i18n/xx/todolist.ts \ - ../../../i18n/en/todolist.ts \ - ../../../i18n/es/todolist.ts \ - ../../../i18n/fr/todolist.ts \ - ../../../i18n/hu/todolist.ts \ - ../../../i18n/ja/todolist.ts \ - ../../../i18n/ko/todolist.ts \ - ../../../i18n/no/todolist.ts \ - ../../../i18n/pl/todolist.ts \ - ../../../i18n/pt/todolist.ts \ - ../../../i18n/pt_BR/todolist.ts \ - ../../../i18n/sl/todolist.ts \ - ../../../i18n/zh_CN/todolist.ts \ - ../../../i18n/zh_TW/todolist.ts - - - include ( $(OPIEDIR)/include.pro ) |