-rw-r--r-- | core/pim/todo/mainwindow.cpp | 20 | ||||
-rw-r--r-- | core/pim/todo/quickeditimpl.cpp | 14 | ||||
-rw-r--r-- | core/pim/todo/tableview.cpp | 21 |
3 files changed, 31 insertions, 24 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp index 0ccf73e..d16d1ac 100644 --- a/core/pim/todo/mainwindow.cpp +++ b/core/pim/todo/mainwindow.cpp @@ -1,286 +1,288 @@ /* =. 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 <stdio.h> #include <qmenubar.h> #include <qmessagebox.h> #include <qtoolbar.h> #include <qpopupmenu.h> #include <qwidgetstack.h> #include <qaction.h> #include <qtimer.h> #include <qvbox.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/qpetoolbar.h> #include <opie/orecur.h> #include <opie/otodoaccessvcal.h> #include "quickeditimpl.h" #include "todotemplatemanager.h" #include "templateeditor.h" #include "tableview.h" #include "textviewshow.h" #include "todoeditor.h" #include "mainwindow.h" using namespace Todo; MainWindow::MainWindow( QWidget* parent, const char* name ) - : OPimMainWindow("Todolist", parent, name) + : OPimMainWindow( "Todolist", parent, name, WType_TopLevel | WStyle_ContextHelp ) { - m_syncing = 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(tr("New from template"), m_template, -1, 0 ); QAction* a = new QAction( tr("New Task" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); connect(a, SIGNAL( activated() ), this, SLOT( slotNew() ) ); + a->setWhatsThis( tr( "Click here to create a new task." ) ); a->addTo(m_tool ); a->addTo(m_edit ); a = new QAction( tr("Edit Task"), Resource::loadIconSet( "edit" ), QString::null, 0, this, 0 ); connect(a, SIGNAL(activated() ), this, SLOT( slotEdit() ) ); + a->setWhatsThis( tr( "Click here to modify the current task." ) ); a->addTo( m_tool ); a->addTo( m_edit ); m_editAction = a; a = new QAction( QString::null, tr("View Task"), 0, this, 0 ); connect(a, SIGNAL( activated() ), this, SLOT( slotShowDetails() ) ); a->addTo( m_edit ); m_edit->insertSeparator(); a = new QAction( tr("Delete..."), Resource::loadIconSet( "trash" ), QString::null, 0, this, 0 ); connect(a, SIGNAL(activated() ), this, SLOT(slotDelete() ) ); + a->setWhatsThis( tr( "Click here to remove the current task." ) ); a->addTo( m_tool ); a->addTo( m_edit ); m_deleteAction = a; a = new QAction( QString::null, 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, 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, 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( tr( "Beam" ), Resource::loadPixmap( "beam" ), - QString::null, 0, this, 0 ); - connect( a, SIGNAL( activated() ), - this, SLOT( slotBeam() ) ); - a->addTo( m_edit ); - a->addTo( m_tool ); + a = new QAction( tr( "Beam" ), Resource::loadPixmap( "beam" ), QString::null, 0, this, 0 ); + connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) ); + a->setWhatsThis( tr( "Click here to send the current task to another device." ) ); + a->addTo( m_edit ); + a->addTo( m_tool ); } // Options menu a = new QAction( 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(); m_completedAction = new QAction( QString::null, 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, 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, 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, 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( tr("Data") ,m_edit ); m_bar->insertItem( tr("Category"), m_catMenu ); m_bar->insertItem( tr("Options"), m_options ); m_curQuick = new QuickEditImpl( this, m_quicktask ); addToolBar( (QPEToolBar *)m_curQuick->widget(), 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 QWidgetStack(this, "main stack"); setCentralWidget( m_stack ); setToolBarsMovable( FALSE ); m_tool = new QPEToolBar( this ); m_tool->setHorizontalStretchable( TRUE ); m_bar = new QMenuBar( m_tool ); /** 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, 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); 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; diff --git a/core/pim/todo/quickeditimpl.cpp b/core/pim/todo/quickeditimpl.cpp index cadec03..7664ee4 100644 --- a/core/pim/todo/quickeditimpl.cpp +++ b/core/pim/todo/quickeditimpl.cpp @@ -1,90 +1,94 @@ #include <qaction.h> #include <qlineedit.h> +#include <qwhatsthis.h> #include <qpe/resource.h> #include <opie/oclickablelabel.h> #include "mainwindow.h" #include "quickeditimpl.h" QuickEditImpl::QuickEditImpl( QWidget* parent, bool visible ) : QPEToolBar( (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 priority1 = Resource::loadPixmap( "todo/priority1" ); priority3 = Resource::loadPixmap( "todo/priority3" ); priority5 = Resource::loadPixmap( "todo/priority5" ); - - - // TODO - come up with icons and replace text priority values + m_lbl = new OClickableLabel( this ); - m_lbl->setMinimumWidth(15); + m_lbl->setMinimumWidth( 15 ); m_lbl->setPixmap( priority3 ); connect(m_lbl, SIGNAL(clicked() ), this, SLOT(slotPrio()) ); + QWhatsThis::add( m_lbl, 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, 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." ) ); + QAction *a = new QAction( tr( "More" ), Resource::loadPixmap( "todo/more" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( slotMore() ) ); a->addTo( this ); + a->setWhatsThis( 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." ) ); a = new QAction( tr( "Enter" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( slotEnter() ) ); a->addTo( this ); + a->setWhatsThis( 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( tr( "Cancel" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( slotCancel() ) ); a->addTo( this ); + a->setWhatsThis( 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() { } OTodo QuickEditImpl::todo()const { return m_todo; } QWidget* QuickEditImpl::widget() { return this; } void QuickEditImpl::slotEnter() { OTodo 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: diff --git a/core/pim/todo/tableview.cpp b/core/pim/todo/tableview.cpp index d229f52..cd6740a 100644 --- a/core/pim/todo/tableview.cpp +++ b/core/pim/todo/tableview.cpp @@ -14,146 +14,147 @@ : .. .:, . . . 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. */ #include <stdlib.h> #include <cmath> #include <qcombobox.h> #include <qlineedit.h> #include <qtimer.h> #include <qpoint.h> #include <qpopupmenu.h> #include <qpe/config.h> #include <qpe/resource.h> #include <opie/orecur.h> #include "mainwindow.h" //#include "tableitems.h" #include "tableview.h" using namespace Todo; namespace { static const int BoxSize = 14; static const int RowHeight = 20; } void TableView::initConfig() { Config config( "todo" ); config.setGroup( "Options" ); m_completeStrokeWidth = config.readNumEntry( "CompleteStrokeWidth", 8 ); } TableView::TableView( MainWindow* window, QWidget* wid ) : QTable( wid ), TodoView( window ) { + + // Load icons + // TODO - probably should be done globally somewhere else, see also quickeditimpl.cpp/h + m_pic_completed = Resource::loadPixmap( "todo/completed" ); + QString namestr; + for ( unsigned int i = 1; i < 6; i++ ) { + namestr = "todo/priority"; + namestr.append( QString::number( i ) ); + m_pic_priority[ i - 1 ] = Resource::loadPixmap( namestr ); + } + setUpdatesEnabled( false ); viewport()->setUpdatesEnabled( false ); m_enablePaint = false; setNumRows(0); setNumCols(4); horizontalHeader()->setLabel( 0, tr("C.") ); horizontalHeader()->setLabel( 1, tr("Priority") ); horizontalHeader()->setLabel( 2, tr("Description" ) ); horizontalHeader()->setLabel( 3, tr("Deadline") ); setShowDeadline( todoWindow()->showDeadline() ); setSorting( TRUE ); setSelectionMode( NoSelection ); setLeftMargin( 0 ); verticalHeader()->hide(); connect((QTable*)this, SIGNAL( clicked( int, int, int, const QPoint& ) ), this, SLOT( slotClicked(int, int, int, const QPoint& ) ) ); connect((QTable*)this, SIGNAL( pressed( int, int, int, const QPoint& ) ), this, SLOT( slotPressed(int, int, int, const QPoint& ) ) ); connect((QTable*)this, SIGNAL(valueChanged(int, int) ), this, SLOT( slotValueChanged(int, int) ) ); connect((QTable*)this, SIGNAL(currentChanged(int, int) ), this, SLOT( slotCurrentChanged(int, int) ) ); m_menuTimer = new QTimer( this ); connect( m_menuTimer, SIGNAL(timeout()), this, SLOT(slotShowMenu()) ); m_enablePaint = true; setUpdatesEnabled( true ); viewport()->setUpdatesEnabled( true ); viewport()->update(); setSortOrder( 0 ); setAscending( TRUE ); m_first = true; - // Load icons - // TODO - probably should be done globally somewhere else, see also quickeditimpl.cpp/h - m_pic_completed = Resource::loadPixmap( "todo/completed" ); - QString namestr; - for ( unsigned int i = 1; i < 6; i++ ) { - namestr = "todo/priority"; - namestr.append( QString::number( i ) ); - m_pic_priority[ i - 1 ] = Resource::loadPixmap( namestr ); - } - /* now let's init the config */ initConfig(); } /* a new day has started * update the day */ void TableView::newDay() { clear(); updateView(); } TableView::~TableView() { } void TableView::slotShowMenu() { QPopupMenu *menu = todoWindow()->contextMenu( current(), sorted()[currentRow()].recurrence().doesRecur() ); menu->exec(QCursor::pos() ); delete menu; } QString TableView::type() const { return QString::fromLatin1( tr("Table View") ); } int TableView::current() { int uid = sorted().uidAt(currentRow() ); return uid; } QString TableView::currentRepresentation() { OTodo to = sorted()[currentRow()]; return to.summary().isEmpty() ? to.description().left(20) : to.summary() ; } /* show overdue */ void TableView::showOverDue( bool ) { clear(); updateView(); } void TableView::updateView( ) { qWarning("update view"); m_row = false; static int id; id = startTimer(4000 ); /* FIXME we want one page to be read! * * Calculate that screensize */ todoWindow()->setReadAhead( 4 ); sort(); OTodoAccess::List::Iterator it, end; |