author | zecke <zecke> | 2004-03-14 19:20:59 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-03-14 19:20:59 (UTC) |
commit | cbb87c7c24dfe46462602c73b10bd76ce81a3baf (patch) (side-by-side diff) | |
tree | ff803045e142f3a5013895be2623a4b5c76531fb | |
parent | 601330a1173afbc7736d103a584b8bde20646dee (diff) | |
download | opie-cbb87c7c24dfe46462602c73b10bd76ce81a3baf.zip opie-cbb87c7c24dfe46462602c73b10bd76ce81a3baf.tar.gz opie-cbb87c7c24dfe46462602c73b10bd76ce81a3baf.tar.bz2 |
Make use of ODP namespace
-rw-r--r-- | core/pim/todo/mainwindow.cpp | 4 | ||||
-rw-r--r-- | core/pim/todo/mainwindow.h | 4 | ||||
-rw-r--r-- | core/pim/todo/otaskeditor.cpp | 1 | ||||
-rw-r--r-- | core/pim/todo/otaskeditor.h | 2 | ||||
-rw-r--r-- | core/pim/todo/quickeditimpl.cpp | 3 | ||||
-rw-r--r-- | core/pim/todo/taskeditoralarms.cpp | 1 |
6 files changed, 10 insertions, 5 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp index c2f422d..f0642c4 100644 --- a/core/pim/todo/mainwindow.cpp +++ b/core/pim/todo/mainwindow.cpp @@ -1,319 +1,321 @@ /* =. This file is part of the OPIE Project .=l. Copyright (c) 2002 <> .>+-= _;:, .> :=|. This program is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This program is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; Library General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <unistd.h> #include <opie2/opimrecurrence.h> #include <opie2/opimnotifymanager.h> #include <opie2/otodoaccessvcal.h> #include <opie2/oapplicationfactory.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/qpeapplication.h> #include <qmenubar.h> #include <qmessagebox.h> #include <qpushbutton.h> #include <qaction.h> #include <qtimer.h> #include <qlayout.h> #include <qwhatsthis.h> #include "quickeditimpl.h" #include "todotemplatemanager.h" #include "templateeditor.h" #include "tableview.h" #include "textviewshow.h" #include "todoeditor.h" #include "mainwindow.h" +using namespace Opie::Core; OPIE_EXPORT_APP( OApplicationFactory<Todo::MainWindow> ) + using namespace Opie; using namespace Todo; MainWindow::MainWindow( QWidget* parent, const char* name, WFlags ) : Opie::OPimMainWindow( "Todolist", parent, name, WType_TopLevel | WStyle_ContextHelp ) { if (!name) setName("todo window"); 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() { // Data menu m_edit->insertItem(QWidget::tr("New from template"), m_template, -1, 0 ); QAction* a = new QAction( QWidget::tr("New Task" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); connect(a, SIGNAL( activated() ), this, SLOT( slotNew() ) ); a->setWhatsThis( QWidget::tr( "Click here to create a new task." ) ); a->addTo(m_tool ); a->addTo(m_edit ); a = new QAction( QWidget::tr("Edit Task"), Resource::loadIconSet( "edit" ), QString::null, 0, this, 0 ); connect(a, SIGNAL(activated() ), this, SLOT( slotEdit() ) ); a->setWhatsThis( QWidget::tr( "Click here to modify the current task." ) ); a->addTo( m_tool ); a->addTo( m_edit ); m_editAction = a; a = new QAction( QString::null, QWidget::tr("View Task"), 0, this, 0 ); connect(a, SIGNAL( activated() ), this, SLOT( slotShowDetails() ) ); a->addTo( m_edit ); m_edit->insertSeparator(); a = new QAction( QWidget::tr("Delete..."), Resource::loadIconSet( "trash" ), QString::null, 0, this, 0 ); connect(a, SIGNAL(activated() ), this, SLOT(slotDelete() ) ); a->setWhatsThis( QWidget::tr( "Click here to remove the current task." ) ); a->addTo( m_tool ); a->addTo( m_edit ); m_deleteAction = a; a = new QAction( QString::null, QWidget::tr("Delete all..."), 0, this, 0 ); connect(a, SIGNAL( activated() ), this, SLOT( slotDeleteAll() ) ); a->addTo(m_edit ); m_deleteAllAction = a; a = new QAction( QString::null, QWidget::tr("Delete completed"), 0, this, 0 ); connect(a, SIGNAL( activated() ), this, SLOT( slotDeleteCompleted() ) ); a->addTo(m_edit ); a->setEnabled( TRUE ); m_deleteCompleteAction = a; m_edit->insertSeparator(); a = new QAction( QString::null, QWidget::tr("Duplicate"), 0, this, 0 ); connect(a, SIGNAL( activated() ), this, SLOT( slotDuplicate() ) ); a->addTo(m_edit ); m_duplicateAction = a; m_edit->insertSeparator(); if ( Ir::supported() ) { a = new QAction( QWidget::tr( "Beam" ), Resource::loadPixmap( "beam" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) ); a->setWhatsThis( QWidget::tr( "Click here to send the current task to another device." ) ); a->addTo( m_edit ); a->addTo( m_tool ); } #if 0 // Options menu a = new QAction( QWidget::tr("Find"), Resource::loadIconSet( "mag" ), QString::null, 0, this, 0 ); connect(a, SIGNAL( activated() ), this, SLOT( slotFind() ) ); a->addTo( m_options ); m_findAction = a; m_options->insertSeparator(); #endif m_completedAction = new QAction( QString::null, QWidget::tr("Show completed tasks"), 0, this, 0, TRUE ); m_completedAction->addTo( m_options ); m_completedAction->setOn( showCompleted() ); connect(m_completedAction, SIGNAL( toggled(bool) ), this, SLOT(slotShowCompleted(bool) ) ); a = new QAction( QString::null, QWidget::tr("Show only over-due tasks"), 0, this, 0, TRUE ); a->addTo( m_options ); a->setOn( showOverDue() ); connect(a, SIGNAL(toggled(bool)), this, SLOT(slotShowDue(bool) ) ); m_showDeadLineAction = new QAction( QString::null, QWidget::tr("Show task deadlines"), 0, this, 0, TRUE ); m_showDeadLineAction->addTo( m_options ); m_showDeadLineAction->setOn( showDeadline() ); connect(m_showDeadLineAction, SIGNAL(toggled(bool) ), this, SLOT( slotShowDeadLine(bool) ) ); m_showQuickTaskAction = new QAction( QString::null, QWidget::tr("Show quick task bar"), 0, this, 0, TRUE ); m_showQuickTaskAction->addTo( m_options ); m_showQuickTaskAction->setOn( showQuickTask() ); connect(m_showQuickTaskAction, SIGNAL( toggled(bool) ), this, SLOT(slotShowQuickTask(bool) ) ); m_options->insertSeparator(); m_bar->insertItem( QWidget::tr("Data") ,m_edit ); m_bar->insertItem( QWidget::tr("Category"), m_catMenu ); m_bar->insertItem( QWidget::tr("Options"), m_options ); m_curQuick = new QuickEditImpl( this, m_quicktask ); addToolBar( (QToolBar *)m_curQuick->widget(), QWidget::tr( "QuickEdit" ), QMainWindow::Top, TRUE ); m_curQuick->signal()->connect( this, SLOT(slotQuickEntered() ) ); } /* m_curCat from Config */ void MainWindow::initConfig() { Config config( "todo" ); config.setGroup( "View" ); m_completed = config.readBoolEntry( "ShowComplete", TRUE ); m_curCat = config.readEntry( "Category", QString::null ); m_deadline = config.readBoolEntry( "ShowDeadLine", TRUE); m_overdue = config.readBoolEntry("ShowOverDue", FALSE ); m_quicktask = config.readBoolEntry("ShowQuickTask", TRUE); } void MainWindow::initUI() { - m_stack = new OWidgetStack(this, "main stack"); + m_stack = new Opie::Ui::OWidgetStack(this, "main stack"); setCentralWidget( m_stack ); setToolBarsMovable( FALSE ); QToolBar *menubarholder = new QToolBar( this ); menubarholder->setHorizontalStretchable( TRUE ); m_bar = new QMenuBar( menubarholder ); m_tool = new QToolBar( this ); /** QPopupMenu */ m_edit = new QPopupMenu( this ); m_options = new QPopupMenu( this ); m_catMenu = new QPopupMenu( this ); m_template = new QPopupMenu( this ); m_catMenu->setCheckable( TRUE ); m_template->setCheckable( TRUE ); connect(m_catMenu, SIGNAL(activated(int) ), this, SLOT(setCategory(int) ) ); connect(m_template, SIGNAL(activated(int) ), this, SLOT(slotNewFromTemplate(int) ) ); } void MainWindow::initViews() { TableView* tableView = new TableView( this, m_stack ); QWhatsThis::add( tableView, QWidget::tr( "This is a listing of all current tasks.\n\nThe list displays the following information:\n1. Completed - A green checkmark indicates task is completed. Click here to complete a task.\n2. Priority - a graphical representation of task priority. Double-click here to modify.\n3. Description - description of task. Click here to select the task.\n4. Deadline - shows when task is due. This column can be shown or hidden by selecting Options->'Show task deadlines' from the menu above." ) ); m_stack->addWidget( tableView, m_counter++ ); m_views.append( tableView ); m_curView = tableView; connectBase( tableView ); /* add QString type + QString configname to * the View menu * and subdirs for multiple views */ } void MainWindow::initEditor() { m_curEdit = new Editor(); } void MainWindow::initShow() { m_curShow = new TextViewShow(this, this); m_stack->addWidget( m_curShow->widget() , m_counter++ ); } MainWindow::~MainWindow() { delete templateManager(); } void MainWindow::connectBase( ViewBase* ) { // once templates and signals mix we'll use it again } QPopupMenu* MainWindow::contextMenu( int , bool recur ) { QPopupMenu* menu = new QPopupMenu(); m_editAction->addTo( menu ); m_deleteAction->addTo( menu ); m_duplicateAction->addTo( menu ); menu->insertSeparator(); /* * if this event recurs we allow * to detach it. * remove all */ if ( recur ) { ; // FIXME } return menu; } QPopupMenu* MainWindow::options() { qWarning("Options"); return m_options; } QPopupMenu* MainWindow::edit() { return m_edit; } QToolBar* MainWindow::toolbar() { return m_tool; } OPimTodoAccess::List MainWindow::list()const { return m_todoMgr.list(); } OPimTodoAccess::List MainWindow::sorted( bool asc, int sortOrder ) { int cat = 0; if ( m_curCat != QWidget::tr("All Categories") ) cat = currentCatId(); if ( m_curCat == QWidget::tr("Unfiled") ) cat = -1; qWarning(" Category %d %s", cat, m_curCat.latin1() ); int filter = 1; if (!m_completed ) diff --git a/core/pim/todo/mainwindow.h b/core/pim/todo/mainwindow.h index b35a42b..f0d6a42 100644 --- a/core/pim/todo/mainwindow.h +++ b/core/pim/todo/mainwindow.h @@ -1,211 +1,211 @@ /* =. This file is part of the OPIE Project .=l. Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> .>+-= _;:, .> :=|. This program is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This program is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; Library General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef TODO_MAIN_WINDOW_H #define TODO_MAIN_WINDOW_H #include <qlist.h> #include <opie2/otodoaccess.h> #include <opie2/opimtodo.h> #include <opie2/opimmainwindow.h> #include <opie2/owidgetstack.h> #include "smalltodo.h" #include "todoview.h" #include "quickedit.h" #include "todomanager.h" class QPopupMenu; class QMenuBar; class QToolBar; class QAction; class Ir; class QVBox; class QLineEdit; namespace Todo { typedef TodoView View; class TemplateManager; class Editor; class TodoShow; class TemplateEditor; struct QuickEditBase; class MainWindow : public Opie::OPimMainWindow { Q_OBJECT friend class TodoView; // avoid QObject here.... friend class TodoShow; // avoid QObject public: - /* OApplicationFactory application Name */ + /* Opie::Core::OApplicationFactory application Name */ static QString appName() { return QString::fromLatin1("todolist"); } MainWindow( QWidget *parent = 0, const char* name = 0, WFlags fl = 0 ); ~MainWindow(); /** return a context menu for an OPimTodo */ QPopupMenu* contextMenu(int uid, bool doesRecur = FALSE ); QPopupMenu* options(); QPopupMenu* edit(); QToolBar* toolbar(); void updateList(); OPimTodoAccess::List list()const; OPimTodoAccess::List sorted( bool asc, int sortOrder ); OPimTodoAccess::List sorted( bool asc, int sortOrder, int addFilter ); OPimTodo 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(); QuickEditBase* quickEditor(); void updateTodo( const OPimTodo& ); void populateTemplates(); Editor* currentEditor(); void setReadAhead(uint count ); private slots: void slotQuickEntered(); void populateCategories(); void slotReload(); void slotFlush(); protected: void closeEvent( QCloseEvent* e ); private: /* handle setting and removing alarms */ void handleAlarms( const OPimTodo& oldTodo, const OPimTodo& newTodo ); void receiveFile( const QString& filename ); void connectBase( ViewBase* ); void initUI(); void initActions(); void initConfig(); void initViews(); void initEditor(); void initShow(); void initTemplate(); void raiseCurrentView(); ViewBase* currentView(); ViewBase* m_curView; bool m_showing : 1; // used to see if we show a todo in the cases we shouldn't change the table QuickEditBase* m_curQuick; Editor* m_curEdit; TodoShow* currentShow(); TodoShow* m_curShow; TemplateEditor* currentTemplateEditor(); TemplateEditor* m_curTempEd; QMenuBar* m_bar; QToolBar* m_tool; QAction* m_editAction, *m_deleteAction, *m_findAction, *m_completedAction, *m_showDeadLineAction, *m_deleteAllAction, *m_deleteCompleteAction, *m_duplicateAction, *m_showOverDueAction, *m_showQuickTaskAction, *m_effectiveAction; - Opie::OWidgetStack *m_stack; + Opie::Ui::OWidgetStack *m_stack; QPopupMenu* m_catMenu, *m_edit, *m_options, *m_template; bool m_syncing:1; bool m_deadline:1; bool m_completed:1; bool m_overdue:1; bool m_quicktask:1; TodoManager m_todoMgr; QString m_curCat; QList<ViewBase> m_views; uint m_counter; TemplateManager* m_tempManager; private slots: void slotShow(int); void slotEdit(int); void slotUpdate3( QWidget* ); void slotComplete( int uid ); void slotComplete( const OPimTodo& ev ); void slotNewFromTemplate(int id ); void slotNew(); void slotDuplicate(); void slotDelete(); void slotDelete(int uid ); void slotDeleteAll(); void slotDeleteCompleted(); void slotEdit(); void slotFind(); void setCategory( int ); void slotShowDeadLine( bool ); void slotShowCompleted( bool ); void slotShowQuickTask( bool ); void setDocument( const QString& ); void slotBeam(); void beamDone( Ir* ); void slotShowDetails(); void slotShowNext(); void slotShowPrev(); void slotShowDue( bool ); void slotReturnFromView(); // for TodoShow... /* reimplementation from opimmainwindow */ protected slots: void flush(); void reload(); int create(); bool remove( int uid ); void beam(int uid); void show( int uid ); void edit( int uid ); void add( const Opie::OPimRecord& ); void doAlarm( const QDateTime& dt, int uid ); }; } #endif diff --git a/core/pim/todo/otaskeditor.cpp b/core/pim/todo/otaskeditor.cpp index d1e50f7..f0128bc 100644 --- a/core/pim/todo/otaskeditor.cpp +++ b/core/pim/todo/otaskeditor.cpp @@ -1,90 +1,91 @@ #include <qlayout.h> #include "taskeditoroverview.h" #include "taskeditorstatus.h" #include "taskeditoralarms.h" #include "otaskeditor.h" +using namespace Opie::Ui; OTaskEditor::OTaskEditor(int cur) : QDialog( 0, 0, TRUE, WStyle_ContextHelp ) { init(); init( cur ); } OTaskEditor::OTaskEditor( const OPimTodo& to) : QDialog( 0, 0, TRUE, WStyle_ContextHelp ) { init(); init( to ); } OTaskEditor::~OTaskEditor() { } void OTaskEditor::init( int cur ) { OPimTodo to; to.setUid( 1 ); // generate a new uid if ( cur != 0 ) to.setCategories( cur ); load(to); } void OTaskEditor::init( const OPimTodo& to ) { load( to ); } OPimTodo OTaskEditor::todo()const{ qWarning("saving!"); OPimTodo to ( m_todo ); m_overView->save( to ); m_stat->save( to ); to.setRecurrence( m_rec->recurrence() ); m_alarm->save( to ); return to; } void OTaskEditor::load(const OPimTodo& to) { m_overView->load( to ); m_stat->load( to ); m_rec->setRecurrence( to.recurrence(), to.hasDueDate() ? to.dueDate() : QDate::currentDate() ); m_alarm->load( to ); m_todo = to; } void OTaskEditor::init() { setCaption(tr("Task Editor") ); QVBoxLayout* layo = new QVBoxLayout( this ); m_tab = new OTabWidget( this ); layo->addWidget( m_tab ); /* * Add the Widgets */ m_overView = new TaskEditorOverView( m_tab ); m_tab->addTab( m_overView, "todo/info", tr("Information") ); m_stat = new TaskEditorStatus( m_tab ); m_tab->addTab( m_stat, "todo/TodoList", tr("Status") ); m_alarm = new TaskEditorAlarms( m_tab ); m_tab->addTab( m_alarm, "todo/alarm", tr("Alarms") ); // m_remind = new TaskEditorAlarms( m_tab ); // m_tab->addTab( m_remind, "todo/reminder", tr("Reminders") ); // QLabel* lbl = new QLabel( m_tab ); // lbl->setText( tr("X-Ref") ); // m_tab->addTab( lbl, "todo/xref", tr("X-Ref") ); m_rec = new OPimRecurrenceWidget( true, QDate::currentDate(), this ); m_tab->addTab( m_rec, "repeat", tr("Recurrence") ); /* signal and slots */ connect(m_overView, SIGNAL(recurranceEnabled(bool) ), m_rec, SLOT(setEnabled(bool) ) ); /* connect due date changed to the recurrence tab */ connect(m_stat, SIGNAL(dueDateChanged(const QDate&) ), m_rec, SLOT(setStartDate(const QDate&) ) ); m_tab->setCurrentTab( m_overView ); } diff --git a/core/pim/todo/otaskeditor.h b/core/pim/todo/otaskeditor.h index 7068df8..4a00018 100644 --- a/core/pim/todo/otaskeditor.h +++ b/core/pim/todo/otaskeditor.h @@ -1,43 +1,43 @@ #ifndef OPIE_TASK_EDITOR_H #define OPIE_TASK_EDITOR_H #include <qdialog.h> #include <opie2/opimtodo.h> #include <opie2/otabwidget.h> #include <opie2/opimrecurrencewidget.h> class TaskEditorOverView; class TaskEditorStatus; class TaskEditorAlarms; class QMultiLineEdit; class OTaskEditor : public QDialog { Q_OBJECT public: OTaskEditor(int cur); OTaskEditor( const OPimTodo& todo ); ~OTaskEditor(); /* * same as the c'tor but this gives us the * power to 'preload' the dialog */ void init( int cur ); void init( const OPimTodo& todo ); OPimTodo todo()const; private: void load( const OPimTodo& ); void init(); - OTabWidget *m_tab; + Opie::Ui::OTabWidget *m_tab; TaskEditorOverView *m_overView; TaskEditorStatus *m_stat; TaskEditorAlarms *m_alarm; TaskEditorAlarms *m_remind; OPimRecurrenceWidget *m_rec; OPimTodo m_todo; }; #endif diff --git a/core/pim/todo/quickeditimpl.cpp b/core/pim/todo/quickeditimpl.cpp index 94ae97e..90ad19e 100644 --- a/core/pim/todo/quickeditimpl.cpp +++ b/core/pim/todo/quickeditimpl.cpp @@ -1,116 +1,117 @@ #include <qaction.h> #include <qlineedit.h> #include <qwhatsthis.h> #include <qpe/resource.h> #include <opie2/oclickablelabel.h> #include "mainwindow.h" #include "quickeditimpl.h" + QuickEditImpl::QuickEditImpl( QWidget* parent, bool visible ) : QToolBar( (QMainWindow *)parent ), Todo::QuickEdit( (Todo::MainWindow *)parent ) { setHorizontalStretchable( TRUE ); // Load priority icons // TODO - probably should be done globally somewhere else, // see also tableview.cpp/h, taskeditoroverview.cpp/h priority1 = Resource::loadPixmap( "todo/priority1" ); priority3 = Resource::loadPixmap( "todo/priority3" ); priority5 = Resource::loadPixmap( "todo/priority5" ); - m_lbl = new Opie::OClickableLabel( this ); + m_lbl = new Opie::Ui::OClickableLabel( this ); m_lbl->setMinimumWidth( 15 ); m_lbl->setPixmap( priority3 ); connect(m_lbl, SIGNAL(clicked() ), this, SLOT(slotPrio()) ); QWhatsThis::add( m_lbl, QWidget::tr( "Click here to set the priority of new task.\n\nThis area is called the quick task bar.\n\nIt allows you to quickly add a new task to your list. This area can be shown or hidden by selecting Options->'Show quick task bar' from the menu above." ) ); m_edit = new QLineEdit( this ); setStretchableWidget( m_edit ); QWhatsThis::add( m_edit, QWidget::tr( "Enter description of new task here.\n\nThis area is called the quick task bar.\n\nIt allows you to quickly add a new task to your list. This area can be shown or hidden by selecting Options->'Show quick task bar' from the menu above." ) ); /* * it's not implemented and won't be implemented for 1.0 */ #if 0 QAction *a = new QAction( QWidget::tr( "More" ), Resource::loadPixmap( "todo/more" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( slotMore() ) ); a->addTo( this ); a->setWhatsThis( QWidget::tr( "Click here to enter additional information for new task.\n\nThis area is called the quick task bar.\n\nIt allows you to quickly add a new task to your list. This area can be shown or hidden by selecting Options->'Show quick task bar' from the menu above." ) ); #endif QAction *a = new QAction( QWidget::tr( "Enter" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( slotEnter() ) ); a->addTo( this ); a->setWhatsThis( QWidget::tr( "Click here to add new task.\n\nThis area is called the quick task bar.\n\nIt allows you to quickly add a new task to your list. This area can be shown or hidden by selecting Options->'Show quick task bar' from the menu above." ) ); a = new QAction( QWidget::tr( "Cancel" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( slotCancel() ) ); a->addTo( this ); a->setWhatsThis( QWidget::tr( "Click here to reset new task information.\n\nThis area is called the quick task bar.\n\nIt allows you to quickly add a new task to your list. This area can be shown or hidden by selecting Options->'Show quick task bar' from the menu above." ) ); m_visible = visible; if ( !m_visible ) { hide(); } m_menu = 0l; reinit(); } QuickEditImpl::~QuickEditImpl() { } OPimTodo QuickEditImpl::todo()const { return m_todo; } QWidget* QuickEditImpl::widget() { return this; } void QuickEditImpl::slotEnter() { OPimTodo todo; if (!m_edit->text().isEmpty() ) { todo.setUid(1 ); // new uid todo.setPriority( m_state ); todo.setSummary( m_edit->text() ); if ( ((Todo::MainWindow *)parent())->currentCatId() != 0 ) todo.setCategories( ((Todo::MainWindow *)parent())->currentCatId() ); m_todo = todo; commit(); } m_todo = todo; reinit(); } void QuickEditImpl::slotPrio() { m_state -= 2; if ( m_state < 1 ) m_state = 5; switch( m_state ) { case 1: m_lbl->setPixmap( priority1 ); break; case 5: m_lbl->setPixmap( priority5 ); break; case 3: default: m_lbl->setPixmap( priority3 ); break; } } void QuickEditImpl::slotMore() { // TODO - implement } void QuickEditImpl::slotCancel() { reinit(); } void QuickEditImpl::reinit() { m_state = 3; m_lbl->setPixmap( priority3 ); m_edit->clear(); } diff --git a/core/pim/todo/taskeditoralarms.cpp b/core/pim/todo/taskeditoralarms.cpp index a512fb0..62fc600 100644 --- a/core/pim/todo/taskeditoralarms.cpp +++ b/core/pim/todo/taskeditoralarms.cpp @@ -1,136 +1,137 @@ /* =. This file is part of the OPIE Project .=l. Copyright (c) 2002 <> .>+-= _;:, .> :=|. This program is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This program is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; Library General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "taskeditoralarms.h" #include <opie2/opimnotifymanager.h> #include <opie2/otimepicker.h> #include <qpe/datebookmonth.h> #include <qpe/resource.h> #include <qlistview.h> #include <qlayout.h> +using namespace Opie::Ui; class AlarmItem : public QListViewItem { public: AlarmItem( QListView*, const OPimAlarm& ); ~AlarmItem(); OPimAlarm alarm()const; void setAlarm( const OPimAlarm& ); private: QDateTime m_dt; int m_type; }; AlarmItem::AlarmItem( QListView* view, const OPimAlarm& dt) : QListViewItem(view) { setAlarm( dt ); } void AlarmItem::setAlarm( const OPimAlarm& dt ) { m_dt = dt.dateTime(); m_type = dt.sound(); setText( 0, TimeString::dateString( m_dt.date() ) ); setText( 1, TimeString::timeString( m_dt.time() ) ); setText( 2, m_type == 0 ? QObject::tr("silent") : QObject::tr("loud") ); } AlarmItem::~AlarmItem() { } OPimAlarm AlarmItem::alarm()const{ OPimAlarm al( m_type, m_dt ); return al; } TaskEditorAlarms::TaskEditorAlarms( QWidget* parent, int, const char* name, WFlags fl ) : QWidget( parent, name, fl ) { m_date = m_type = m_time = 0; QGridLayout *layout = new QGridLayout( this, 2, 2, 4, 4 ); lstAlarms = new QListView( this ); lstAlarms->addColumn( tr("Date") ); lstAlarms->addColumn( tr("Time") ); lstAlarms->addColumn( tr("Type") ); connect( lstAlarms, SIGNAL(clicked(QListViewItem*,const QPoint&,int) ), this, SLOT(inlineEdit(QListViewItem*,const QPoint&,int) ) ); layout->addMultiCellWidget( lstAlarms, 0, 0, 0, 2 ); QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), this ); //QWhatsThis::add( btn, tr( "Click here to add a new transaction." ) ); connect( btn, SIGNAL( clicked() ), this, SLOT( slotNew() ) ); layout->addWidget( btn, 1, 0 ); /* use when we've reminders too */ #if 0 btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Edit" ), this ); //QWhatsThis::add( btn, tr( "Select a transaction and then click here to edit it." ) ); connect( btn, SIGNAL( clicked() ), this, SLOT( slotEdit() ) ); layout->addWidget( btn, 1, 1 ); #endif btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), this ); //QWhatsThis::add( btn, tr( "Select a checkbook and then click here to delete it." ) ); connect( btn, SIGNAL( clicked() ), this, SLOT( slotDelete() ) ); layout->addWidget( btn, 1, 2 ); } TaskEditorAlarms::~TaskEditorAlarms(){ } void TaskEditorAlarms::slotNew(){ (void)new AlarmItem(lstAlarms, OPimAlarm(0, QDateTime::currentDateTime() ) ); } void TaskEditorAlarms::slotEdit(){ } void TaskEditorAlarms::slotDelete(){ QListViewItem* item = lstAlarms->currentItem(); if (!item) return; lstAlarms->takeItem( item ); delete item; } void TaskEditorAlarms::load( const OPimTodo& todo) { lstAlarms->clear(); if (!todo.hasNotifiers() ) return; OPimNotifyManager::Alarms als = todo.notifiers().alarms(); if (als.isEmpty() ) return; OPimNotifyManager::Alarms::Iterator it = als.begin(); for ( ; it != als.end(); ++it ) (void)new AlarmItem( lstAlarms, (*it) ); |