-rw-r--r-- | core/pim/todo/mainwindow.cpp | 10 | ||||
-rw-r--r-- | core/pim/todo/mainwindow.h | 1 | ||||
-rw-r--r-- | core/pim/todo/tableview.cpp | 4 | ||||
-rw-r--r-- | core/pim/todo/todoeditor.cpp | 2 |
4 files changed, 5 insertions, 12 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp index b2b3b8f..0ab6230 100644 --- a/core/pim/todo/mainwindow.cpp +++ b/core/pim/todo/mainwindow.cpp @@ -16,97 +16,97 @@ _.=:. : :=>`: 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 <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 <qpe/applnk.h> #include <qpe/config.h> #include <qpe/ir.h> #include <qpe/resource.h> #include <qpe/qpemessagebox.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") + : OPimMainWindow("Todolist", parent, name) { 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() { QAction* a = new QAction( tr("New Task" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); connect(a, SIGNAL( activated() ), this, SLOT( slotNew() ) ); 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->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() ), @@ -207,97 +207,97 @@ void MainWindow::initUI() { m_stack = new QWidgetStack(m_mainBox, "main stack"); setCentralWidget( m_mainBox ); setToolBarsMovable( FALSE ); m_tool = new QToolBar( 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 ); 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* base) { +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; } OTodoAccess::List MainWindow::list()const { return m_todoMgr.list(); } OTodoAccess::List MainWindow::sorted( bool asc, int sortOrder ) { int cat = 0; if ( m_curCat != tr("All Categories") ) cat = currentCatId(); int filter = 1; if (!m_completed ) filter |= 4; if (m_overdue) filter |= 2; return m_todoMgr.sorted( asc, sortOrder, filter, cat ); @@ -752,54 +752,48 @@ int MainWindow::create() { // I'm afraid we must call this every time now, otherwise // spend expensive time comparing all these strings... // but only call if we changed something -zecke populateCategories(); } raiseCurrentView( ); return uid; } /* delete it silently... */ bool MainWindow::remove( int uid ) { if (m_syncing) return false; return m_todoMgr.remove( uid ); } void MainWindow::beam( int uid, int ) { ::unlink( beamfile ); OTodo todo = event( uid ); OTodoAccessVCal* cal = new OTodoAccessVCal(QString::fromLatin1(beamfile) ); OTodoAccess acc( cal ); acc.load(); acc.add( todo ); acc.save(); Ir* ir = new Ir(this ); connect(ir, SIGNAL(done(Ir*) ), this, SLOT(beamDone(Ir*) ) ); ir->send( beamfile, todo.summary(), "text/x-vCalendar" ); } void MainWindow::show( int uid ) { slotShow( uid ); } void MainWindow::edit( int uid ) { slotEdit( uid ); } void MainWindow::add( const OPimRecord& rec) { if ( rec.rtti() != OTodo::rtti() ) return; const OTodo& todo = static_cast<const OTodo&>(rec); m_todoMgr.add(todo ); currentView()->addEvent( todo ); // I'm afraid we must call this every time now, otherwise // spend expensive time comparing all these strings... // but only call if we changed something -zecke populateCategories(); } -/* todo does not have the QDataStream<< and >> operators implemented :( - * FIXME - */ -OPimRecord* MainWindow::record( int rtti, const QByteArray& ) { - return 0l; -} diff --git a/core/pim/todo/mainwindow.h b/core/pim/todo/mainwindow.h index 14cfa82..87a9133 100644 --- a/core/pim/todo/mainwindow.h +++ b/core/pim/todo/mainwindow.h @@ -151,53 +151,52 @@ private slots: bool m_overdue:1; TodoManager m_todoMgr; QString m_curCat; QList<ViewBase> m_views; QList<QuickEditBase> m_quickEdit; uint m_counter; TemplateManager* m_tempManager; private slots: void slotShow(int); void slotEdit(int); void slotUpdate3( QWidget* ); void slotComplete( int uid ); void slotComplete( const OTodo& ev ); void slotNewFromTemplate(int id ); void slotNew(); void slotDuplicate(); void slotDelete(); void slotDeleteAll(); void slotDeleteCompleted(); void slotEdit(); void slotFind(); void setCategory( int ); void slotShowDeadLine( bool ); void slotShowCompleted( bool ); void setDocument( const QString& ); void slotBeam(); void beamDone( Ir* ); void slotShowDetails(); void slotShowDue( bool ); /* reimplementation from opimmainwindow */ protected slots: void flush(); void reload(); int create(); bool remove( int uid ); void beam(int uid, int transport = IrDa ); void show( int uid ); void edit( int uid ); void add( const OPimRecord& ); - OPimRecord* record( int rtti, const QByteArray& ); }; }; #endif diff --git a/core/pim/todo/tableview.cpp b/core/pim/todo/tableview.cpp index 0f683c9..2434150 100644 --- a/core/pim/todo/tableview.cpp +++ b/core/pim/todo/tableview.cpp @@ -125,103 +125,103 @@ 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; it = sorted().begin(); end = sorted().end(); qWarning("setTodos"); QTime time; time.start(); m_enablePaint = false; setUpdatesEnabled( false ); viewport()->setUpdatesEnabled( false ); setNumRows( it.count() ); if ( it.count() == 0 ) killTimer(id); - int elc = time.elapsed(); +// int elc = time.elapsed(); setUpdatesEnabled( true ); viewport()->setUpdatesEnabled( true ); viewport()->update(); m_enablePaint = true; - int el = time.elapsed(); +// int el = time.elapsed(); } void TableView::setTodo( int, const OTodo&) { sort(); /* repaint */ repaint(); } void TableView::addEvent( const OTodo&) { /* fix problems of not showing the 'Haken' */ updateView(); } /* * find the event * and then replace the complete row */ void TableView::replaceEvent( const OTodo& ev) { addEvent( ev ); } /* * re aligning table can be slow too * FIXME: look what performs better * either this or the old align table */ void TableView::removeEvent( int ) { updateView(); } void TableView::setShowCompleted( bool b) { qWarning("Show Completed %d" + b ); updateView(); } void TableView::setShowDeadline( bool b) { qWarning("Show DeadLine %d" + b ); if (b) showColumn(3 ); else hideColumn(3 ); } void TableView::setShowCategory( const QString& str) { qWarning("setShowCategory"); if ( str != m_oleCat || m_first ) updateView(); m_oleCat = str; m_first = false; } void TableView::clear() { diff --git a/core/pim/todo/todoeditor.cpp b/core/pim/todo/todoeditor.cpp index 9b8c5cb..5aa7097 100644 --- a/core/pim/todo/todoeditor.cpp +++ b/core/pim/todo/todoeditor.cpp @@ -1,67 +1,67 @@ #include "otaskeditor.h" #include "todoeditor.h" using namespace Todo; Editor::Editor() { m_accepted = false; m_self = 0l; } Editor::~Editor() { delete m_self; m_self = 0; } OTodo Editor::newTodo( int cur, QWidget*) { OTaskEditor *e = self(); e->setCaption( QObject::tr("Enter Task") ); e->init( cur ); #if defined(Q_WS_QWS) || defined(_WS_QWS_) e->showMaximized(); #endif int ret = e->exec(); if ( QDialog::Accepted == ret ) { m_accepted = true; }else m_accepted = false; OTodo ev = e->todo(); qWarning("Todo uid"); qWarning("Todo %s %d %d", ev.summary().latin1(), ev.progress(), ev.isCompleted() ); ev.setUid(1); return ev; } -OTodo Editor::edit( QWidget *wid, +OTodo Editor::edit( QWidget *, const OTodo& todo ) { OTaskEditor *e = self(); e->init( todo ); e->setCaption( QObject::tr( "Edit Task" ) ); #if defined(Q_WS_QWS) || defined(_WS_QWS_) e->showMaximized(); #endif int ret = e->exec(); OTodo ev = e->todo(); if ( ret == QDialog::Accepted ) m_accepted = true; else m_accepted = false; return ev; } bool Editor::accepted()const { return m_accepted; } OTaskEditor* Editor::self() { if (!m_self ) m_self = new OTaskEditor(0); return m_self; } |