diff options
Diffstat (limited to 'karm/mainwindow.cpp')
-rw-r--r-- | karm/mainwindow.cpp | 226 |
1 files changed, 113 insertions, 113 deletions
diff --git a/karm/mainwindow.cpp b/karm/mainwindow.cpp index 141eafef9..6a80fa009 100644 --- a/karm/mainwindow.cpp +++ b/karm/mainwindow.cpp @@ -18,10 +18,10 @@ #include <kmessagebox.h> #include <kstatusbar.h> // statusBar() #include <kstdaction.h> -#include <qkeycode.h> -#include <qpopupmenu.h> -#include <qptrlist.h> -#include <qstring.h> +#include <tqkeycode.h> +#include <tqpopupmenu.h> +#include <tqptrlist.h> +#include <tqstring.h> #include "karmerrors.h" #include "karmutility.h" @@ -34,7 +34,7 @@ #include "tray.h" #include "version.h" -MainWindow::MainWindow( const QString &icsfile ) +MainWindow::MainWindow( const TQString &icsfile ) : DCOPObject ( "KarmDCOPIface" ), KParts::MainWindow(0,Qt::WStyle_ContextHelp), _accel ( new KAccel( this ) ), @@ -57,33 +57,33 @@ MainWindow::MainWindow( const QString &icsfile ) _watcher->updateMenus(); // connections - connect( _taskView, SIGNAL( totalTimesChanged( long, long ) ), - this, SLOT( updateTime( long, long ) ) ); - connect( _taskView, SIGNAL( selectionChanged ( QListViewItem * )), - this, SLOT(slotSelectionChanged())); - connect( _taskView, SIGNAL( updateButtons() ), - this, SLOT(slotSelectionChanged())); - connect( _taskView, SIGNAL( setStatusBar( QString ) ), - this, SLOT(setStatusBar( QString ))); + connect( _taskView, TQT_SIGNAL( totalTimesChanged( long, long ) ), + this, TQT_SLOT( updateTime( long, long ) ) ); + connect( _taskView, TQT_SIGNAL( selectionChanged ( TQListViewItem * )), + this, TQT_SLOT(slotSelectionChanged())); + connect( _taskView, TQT_SIGNAL( updateButtons() ), + this, TQT_SLOT(slotSelectionChanged())); + connect( _taskView, TQT_SIGNAL( setStatusBar( TQString ) ), + this, TQT_SLOT(setStatusBar( TQString ))); loadGeometry(); // Setup context menu request handling connect( _taskView, - SIGNAL( contextMenuRequested( QListViewItem*, const QPoint&, int )), + TQT_SIGNAL( contextMenuRequested( TQListViewItem*, const TQPoint&, int )), this, - SLOT( contextMenuRequest( QListViewItem*, const QPoint&, int ))); + TQT_SLOT( contextMenuRequest( TQListViewItem*, const TQPoint&, int ))); _tray = new KarmTray( this ); - connect( _tray, SIGNAL( quitSelected() ), SLOT( quit() ) ); + connect( _tray, TQT_SIGNAL( quitSelected() ), TQT_SLOT( quit() ) ); - connect( _taskView, SIGNAL( timersActive() ), _tray, SLOT( startClock() ) ); - connect( _taskView, SIGNAL( timersActive() ), this, SLOT( enableStopAll() )); - connect( _taskView, SIGNAL( timersInactive() ), _tray, SLOT( stopClock() ) ); - connect( _taskView, SIGNAL( timersInactive() ), this, SLOT( disableStopAll())); - connect( _taskView, SIGNAL( tasksChanged( QPtrList<Task> ) ), - _tray, SLOT( updateToolTip( QPtrList<Task> ) )); + connect( _taskView, TQT_SIGNAL( timersActive() ), _tray, TQT_SLOT( startClock() ) ); + connect( _taskView, TQT_SIGNAL( timersActive() ), this, TQT_SLOT( enableStopAll() )); + connect( _taskView, TQT_SIGNAL( timersInactive() ), _tray, TQT_SLOT( stopClock() ) ); + connect( _taskView, TQT_SIGNAL( timersInactive() ), this, TQT_SLOT( disableStopAll())); + connect( _taskView, TQT_SIGNAL( tasksChanged( TQPtrList<Task> ) ), + _tray, TQT_SLOT( updateToolTip( TQPtrList<Task> ) )); _taskView->load(); @@ -134,7 +134,7 @@ void MainWindow::slotSelectionChanged() // actionAddComment->setEnabled( on ); //} -void MainWindow::setStatusBar(QString qs) +void MainWindow::setStatusBar(TQString qs) { statusBar()->message(i18n(qs.ascii())); } @@ -142,7 +142,7 @@ void MainWindow::setStatusBar(QString qs) bool MainWindow::save() { kdDebug(5970) << "Saving time data to disk." << endl; - QString err=_taskView->save(); // untranslated error msg. + TQString err=_taskView->save(); // untranslated error msg. if (err.isEmpty()) statusBar()->message(i18n("Successfully saved tasks and history"),1807); else statusBar()->message(i18n(err.ascii()),7707); // no msgbox since save is called when exiting saveGeometry(); @@ -152,7 +152,7 @@ bool MainWindow::save() void MainWindow::exportcsvHistory() { kdDebug(5970) << "Exporting History to disk." << endl; - QString err=_taskView->exportcsvHistory(); + TQString err=_taskView->exportcsvHistory(); if (err.isEmpty()) statusBar()->message(i18n("Successfully exported History to CSV-file"),1807); else KMessageBox::error(this, err.ascii()); saveGeometry(); @@ -199,7 +199,7 @@ void MainWindow::updateTime( long sessionDiff, long totalDiff ) void MainWindow::updateStatusBar( ) { - QString time; + TQString time; time = formatTime( _sessionSum ); statusBar()->changeItem( i18n("Session: %1").arg(time), 0 ); @@ -251,128 +251,128 @@ void MainWindow::makeMenus() *actionNew, *actionNewSub; - (void) KStdAction::quit( this, SLOT( quit() ), actionCollection()); - (void) KStdAction::print( this, SLOT( print() ), actionCollection()); - actionKeyBindings = KStdAction::keyBindings( this, SLOT( keyBindings() ), + (void) KStdAction::quit( this, TQT_SLOT( quit() ), actionCollection()); + (void) KStdAction::print( this, TQT_SLOT( print() ), actionCollection()); + actionKeyBindings = KStdAction::keyBindings( this, TQT_SLOT( keyBindings() ), actionCollection() ); actionPreferences = KStdAction::preferences(_preferences, - SLOT(showDialog()), + TQT_SLOT(showDialog()), actionCollection() ); - (void) KStdAction::save( this, SLOT( save() ), actionCollection() ); + (void) KStdAction::save( this, TQT_SLOT( save() ), actionCollection() ); KAction* actionStartNewSession = new KAction( i18n("Start &New Session"), 0, this, - SLOT( startNewSession() ), + TQT_SLOT( startNewSession() ), actionCollection(), "start_new_session"); KAction* actionResetAll = new KAction( i18n("&Reset All Times"), 0, this, - SLOT( resetAllTimes() ), + TQT_SLOT( resetAllTimes() ), actionCollection(), "reset_all_times"); actionStart = new KAction( i18n("&Start"), - QString::fromLatin1("1rightarrow"), Key_S, + TQString::fromLatin1("1rightarrow"), Key_S, _taskView, - SLOT( startCurrentTimer() ), actionCollection(), + TQT_SLOT( startCurrentTimer() ), actionCollection(), "start"); actionStop = new KAction( i18n("S&top"), - QString::fromLatin1("stop"), Key_S, + TQString::fromLatin1("stop"), Key_S, _taskView, - SLOT( stopCurrentTimer() ), actionCollection(), + TQT_SLOT( stopCurrentTimer() ), actionCollection(), "stop"); actionStopAll = new KAction( i18n("Stop &All Timers"), Key_Escape, _taskView, - SLOT( stopAllTimers() ), actionCollection(), + TQT_SLOT( stopAllTimers() ), actionCollection(), "stopAll"); actionStopAll->setEnabled(false); actionNew = new KAction( i18n("&New..."), - QString::fromLatin1("filenew"), CTRL+Key_N, + TQString::fromLatin1("filenew"), CTRL+Key_N, _taskView, - SLOT( newTask() ), actionCollection(), + TQT_SLOT( newTask() ), actionCollection(), "new_task"); actionNewSub = new KAction( i18n("New &Subtask..."), - QString::fromLatin1("kmultiple"), CTRL+ALT+Key_N, + TQString::fromLatin1("kmultiple"), CTRL+ALT+Key_N, _taskView, - SLOT( newSubTask() ), actionCollection(), + TQT_SLOT( newSubTask() ), actionCollection(), "new_sub_task"); actionDelete = new KAction( i18n("&Delete"), - QString::fromLatin1("editdelete"), Key_Delete, + TQString::fromLatin1("editdelete"), Key_Delete, _taskView, - SLOT( deleteTask() ), actionCollection(), + TQT_SLOT( deleteTask() ), actionCollection(), "delete_task"); actionEdit = new KAction( i18n("&Edit..."), - QString::fromLatin1("edit"), CTRL + Key_E, + TQString::fromLatin1("edit"), CTRL + Key_E, _taskView, - SLOT( editTask() ), actionCollection(), + TQT_SLOT( editTask() ), actionCollection(), "edit_task"); // actionAddComment = new KAction( i18n("&Add Comment..."), -// QString::fromLatin1("document"), +// TQString::fromLatin1("document"), // CTRL+ALT+Key_E, // _taskView, -// SLOT( addCommentToTask() ), +// TQT_SLOT( addCommentToTask() ), // actionCollection(), // "add_comment_to_task"); actionMarkAsComplete = new KAction( i18n("&Mark as Complete"), - QString::fromLatin1("document"), + TQString::fromLatin1("document"), CTRL+Key_M, _taskView, - SLOT( markTaskAsComplete() ), + TQT_SLOT( markTaskAsComplete() ), actionCollection(), "mark_as_complete"); actionMarkAsIncomplete = new KAction( i18n("&Mark as Incomplete"), - QString::fromLatin1("document"), + TQString::fromLatin1("document"), CTRL+Key_M, _taskView, - SLOT( markTaskAsIncomplete() ), + TQT_SLOT( markTaskAsIncomplete() ), actionCollection(), "mark_as_incomplete"); actionClipTotals = new KAction( i18n("&Copy Totals to Clipboard"), - QString::fromLatin1("klipper"), + TQString::fromLatin1("klipper"), CTRL+Key_C, _taskView, - SLOT( clipTotals() ), + TQT_SLOT( clipTotals() ), actionCollection(), "clip_totals"); // actionClipTotals will never be used again, overwrite it actionClipTotals = new KAction( i18n("&Copy Session Time to Clipboard"), - QString::fromLatin1("klipper"), + TQString::fromLatin1("klipper"), 0, _taskView, - SLOT( clipSession() ), + TQT_SLOT( clipSession() ), actionCollection(), "clip_session"); actionClipHistory = new KAction( i18n("Copy &History to Clipboard"), - QString::fromLatin1("klipper"), + TQString::fromLatin1("klipper"), CTRL+ALT+Key_C, _taskView, - SLOT( clipHistory() ), + TQT_SLOT( clipHistory() ), actionCollection(), "clip_history"); new KAction( i18n("Import &Legacy Flat File..."), 0, - _taskView, SLOT(loadFromFlatFile()), actionCollection(), + _taskView, TQT_SLOT(loadFromFlatFile()), actionCollection(), "import_flatfile"); new KAction( i18n("&Export to CSV File..."), 0, - _taskView, SLOT(exportcsvFile()), actionCollection(), + _taskView, TQT_SLOT(exportcsvFile()), actionCollection(), "export_csvfile"); new KAction( i18n("Export &History to CSV File..."), 0, - this, SLOT(exportcsvHistory()), actionCollection(), + this, TQT_SLOT(exportcsvHistory()), actionCollection(), "export_csvhistory"); new KAction( i18n("Import Tasks From &Planner..."), 0, - _taskView, SLOT(importPlanner()), actionCollection(), + _taskView, TQT_SLOT(importPlanner()), actionCollection(), "import_planner"); /* new KAction( i18n("Import E&vents"), 0, _taskView, - SLOT( loadFromKOrgEvents() ), actionCollection(), + TQT_SLOT( loadFromKOrgEvents() ), actionCollection(), "import_korg_events"); */ - setXMLFile( QString::fromLatin1("karmui.rc") ); + setXMLFile( TQString::fromLatin1("karmui.rc") ); createGUI( 0 ); // Tool tips must be set after the createGUI. @@ -442,9 +442,9 @@ void MainWindow::loadGeometry() { KConfig &config = *kapp->config(); - config.setGroup( QString::fromLatin1("Main Window Geometry") ); - int w = config.readNumEntry( QString::fromLatin1("Width"), 100 ); - int h = config.readNumEntry( QString::fromLatin1("Height"), 100 ); + config.setGroup( TQString::fromLatin1("Main Window Geometry") ); + int w = config.readNumEntry( TQString::fromLatin1("Width"), 100 ); + int h = config.readNumEntry( TQString::fromLatin1("Height"), 100 ); w = QMAX( w, sizeHint().width() ); h = QMAX( h, sizeHint().height() ); resize(w, h); @@ -455,9 +455,9 @@ void MainWindow::loadGeometry() void MainWindow::saveGeometry() { KConfig &config = *KGlobal::config(); - config.setGroup( QString::fromLatin1("Main Window Geometry")); - config.writeEntry( QString::fromLatin1("Width"), width()); - config.writeEntry( QString::fromLatin1("Height"), height()); + config.setGroup( TQString::fromLatin1("Main Window Geometry")); + config.writeEntry( TQString::fromLatin1("Width"), width()); + config.writeEntry( TQString::fromLatin1("Height"), height()); config.sync(); } @@ -470,9 +470,9 @@ bool MainWindow::queryClose() return KMainWindow::queryClose(); } -void MainWindow::contextMenuRequest( QListViewItem*, const QPoint& point, int ) +void MainWindow::contextMenuRequest( TQListViewItem*, const TQPoint& point, int ) { - QPopupMenu* pop = dynamic_cast<QPopupMenu*>( + TQPopupMenu* pop = dynamic_cast<TQPopupMenu*>( factory()->container( i18n( "task_popup" ), this ) ); if ( pop ) pop->popup( point ); @@ -484,12 +484,12 @@ void MainWindow::contextMenuRequest( QListViewItem*, const QPoint& point, int ) // //---------------------------------------------------------------------------- -QString MainWindow::version() const +TQString MainWindow::version() const { return KARM_VERSION; } -QString MainWindow::deletetodo() +TQString MainWindow::deletetodo() { _taskView->deleteTask(); return ""; @@ -500,15 +500,15 @@ bool MainWindow::getpromptdelete() return _preferences->promptDelete(); } -QString MainWindow::setpromptdelete( bool prompt ) +TQString MainWindow::setpromptdelete( bool prompt ) { _preferences->setPromptDelete( prompt ); return ""; } -QString MainWindow::taskIdFromName( const QString &taskname ) const +TQString MainWindow::taskIdFromName( const TQString &taskname ) const { - QString rval = ""; + TQString rval = ""; Task* task = _taskView->first_child(); while ( rval.isEmpty() && task ) @@ -520,10 +520,10 @@ QString MainWindow::taskIdFromName( const QString &taskname ) const return rval; } -int MainWindow::addTask( const QString& taskname ) +int MainWindow::addTask( const TQString& taskname ) { DesktopList desktopList; - QString uid = _taskView->addTask( taskname, 0, 0, desktopList ); + TQString uid = _taskView->addTask( taskname, 0, 0, desktopList ); kdDebug(5970) << "MainWindow::addTask( " << taskname << " ) returns " << uid << endl; if ( uid.length() > 0 ) return 0; else @@ -534,20 +534,20 @@ int MainWindow::addTask( const QString& taskname ) } } -QString MainWindow::setPerCentComplete( const QString& taskName, int perCent ) +TQString MainWindow::setPerCentComplete( const TQString& taskName, int perCent ) { int index; - QString err="no such task"; + TQString err="no such task"; for (int i=0; i<_taskView->count(); i++) { if ((_taskView->item_at_index(i)->name()==taskName)) { index=i; - if (err==QString::null) err="task name is abigious"; - if (err=="no such task") err=QString::null; + if (err==TQString::null) err="task name is abigious"; + if (err=="no such task") err=TQString::null; } } - if (err==QString::null) + if (err==TQString::null) { _taskView->item_at_index(index)->setPercentComplete( perCent, _taskView->storage() ); } @@ -555,12 +555,12 @@ QString MainWindow::setPerCentComplete( const QString& taskName, int perCent ) } int MainWindow::bookTime -( const QString& taskId, const QString& datetime, long minutes ) +( const TQString& taskId, const TQString& datetime, long minutes ) { int rval = 0; - QDate startDate; - QTime startTime; - QDateTime startDateTime; + TQDate startDate; + TQTime startTime; + TQDateTime startDateTime; Task *task, *t; if ( minutes <= 0 ) rval = KARM_ERR_INVALID_DURATION; @@ -578,15 +578,15 @@ int MainWindow::bookTime // Parse datetime if ( !rval ) { - startDate = QDate::fromString( datetime, Qt::ISODate ); + startDate = TQDate::fromString( datetime, Qt::ISODate ); if ( datetime.length() > 10 ) // "YYYY-MM-DD".length() = 10 { - startTime = QTime::fromString( datetime, Qt::ISODate ); + startTime = TQTime::fromString( datetime, Qt::ISODate ); } - else startTime = QTime( 12, 0 ); + else startTime = TQTime( 12, 0 ); if ( startDate.isValid() && startTime.isValid() ) { - startDateTime = QDateTime( startDate, startTime ); + startDateTime = TQDateTime( startDate, startTime ); } else rval = KARM_ERR_INVALID_DATE; @@ -607,13 +607,13 @@ int MainWindow::bookTime // There was something really bad going on with DCOP when I used a particular // argument name; if I recall correctly, the argument name was errno. -QString MainWindow::getError( int mkb ) const +TQString MainWindow::getError( int mkb ) const { if ( mkb <= KARM_MAX_ERROR_NO ) return m_error[ mkb ]; else return i18n( "Invalid error number: %1" ).arg( mkb ); } -int MainWindow::totalMinutesForTaskId( const QString& taskId ) +int MainWindow::totalMinutesForTaskId( const TQString& taskId ) { int rval = 0; Task *task, *t; @@ -642,9 +642,9 @@ int MainWindow::totalMinutesForTaskId( const QString& taskId ) return rval; } -QString MainWindow::_hasTask( Task* task, const QString &taskname ) const +TQString MainWindow::_hasTask( Task* task, const TQString &taskname ) const { - QString rval = ""; + TQString rval = ""; if ( task->name() == taskname ) { rval = task->uid(); @@ -661,7 +661,7 @@ QString MainWindow::_hasTask( Task* task, const QString &taskname ) const return rval; } -Task* MainWindow::_hasUid( Task* task, const QString &uid ) const +Task* MainWindow::_hasUid( Task* task, const TQString &uid ) const { Task *rval = NULL; @@ -679,49 +679,49 @@ Task* MainWindow::_hasUid( Task* task, const QString &uid ) const } return rval; } -QString MainWindow::starttimerfor( const QString& taskname ) +TQString MainWindow::starttimerfor( const TQString& taskname ) { int index; - QString err="no such task"; + TQString err="no such task"; for (int i=0; i<_taskView->count(); i++) { if ((_taskView->item_at_index(i)->name()==taskname)) { index=i; - if (err==QString::null) err="task name is abigious"; - if (err=="no such task") err=QString::null; + if (err==TQString::null) err="task name is abigious"; + if (err=="no such task") err=TQString::null; } } - if (err==QString::null) _taskView->startTimerFor( _taskView->item_at_index(index) ); + if (err==TQString::null) _taskView->startTimerFor( _taskView->item_at_index(index) ); return err; } -QString MainWindow::stoptimerfor( const QString& taskname ) +TQString MainWindow::stoptimerfor( const TQString& taskname ) { int index; - QString err="no such task"; + TQString err="no such task"; for (int i=0; i<_taskView->count(); i++) { if ((_taskView->item_at_index(i)->name()==taskname)) { index=i; - if (err==QString::null) err="task name is abigious"; - if (err=="no such task") err=QString::null; + if (err==TQString::null) err="task name is abigious"; + if (err=="no such task") err=TQString::null; } } - if (err==QString::null) _taskView->stopTimerFor( _taskView->item_at_index(index) ); + if (err==TQString::null) _taskView->stopTimerFor( _taskView->item_at_index(index) ); return err; } -QString MainWindow::exportcsvfile( QString filename, QString from, QString to, int type, bool decimalMinutes, bool allTasks, QString delimiter, QString quote ) +TQString MainWindow::exportcsvfile( TQString filename, TQString from, TQString to, int type, bool decimalMinutes, bool allTasks, TQString delimiter, TQString quote ) { ReportCriteria rc; rc.url=filename; - rc.from=QDate::fromString( from ); - if ( rc.from.isNull() ) rc.from=QDate::fromString( from, Qt::ISODate ); + rc.from=TQDate::fromString( from ); + if ( rc.from.isNull() ) rc.from=TQDate::fromString( from, Qt::ISODate ); kdDebug(5970) << "rc.from " << rc.from << endl; - rc.to=QDate::fromString( to ); - if ( rc.to.isNull() ) rc.to=QDate::fromString( to, Qt::ISODate ); + rc.to=TQDate::fromString( to ); + if ( rc.to.isNull() ) rc.to=TQDate::fromString( to, Qt::ISODate ); kdDebug(5970) << "rc.to " << rc.to << endl; rc.reportType=(ReportCriteria::REPORTTYPE) type; // history report or totals report rc.decimalMinutes=decimalMinutes; @@ -731,7 +731,7 @@ QString MainWindow::exportcsvfile( QString filename, QString from, QString to, i return _taskView->report( rc ); } -QString MainWindow::importplannerfile( QString fileName ) +TQString MainWindow::importplannerfile( TQString fileName ) { return _taskView->importPlanner(fileName); } |