-rw-r--r-- | korganizer/calprintbase.cpp | 2 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 23 |
2 files changed, 17 insertions, 8 deletions
diff --git a/korganizer/calprintbase.cpp b/korganizer/calprintbase.cpp index af32ebc..6bb407d 100644 --- a/korganizer/calprintbase.cpp +++ b/korganizer/calprintbase.cpp @@ -872,97 +872,97 @@ void CalPrintBase::drawMonth(QPainter &p, const QDate &qd, bool weeknumbers, if ( (monthDate < monthFirst) || (monthDate > monthLast) ) { p.setBackgroundColor( QColor( 240, 240, 240) ); darkbg = true; } drawDayBox(p, monthDate, x+xoffset+col*cellWidth, y+yoffset+row*cellHeight, cellWidth, cellHeight); if ( darkbg ) { p.setBackgroundColor( back ); darkbg = false; } monthDate = monthDate.addDays(1); } } } /////////////////////////////////////////////////////////////////////////////// void CalPrintBase::drawTodo( bool completed, int &count, Todo * item, QPainter &p, bool connectSubTodos, bool desc, int pospriority, int possummary, int posDueDt, int level, int x, int &y, int width, int &height, int pageHeight, TodoParentStart *r ) { if ( !completed && item->isCompleted() ) return; QString outStr; // int fontHeight = 10; const KLocale *local = KGlobal::locale(); int priority=item->priority(); int posdue=posDueDt; if (posdue<0) posdue=x+width; QRect rect; TodoParentStart startpt; // This list keeps all starting points of the parent todos so the connection // lines of the tree can easily be drawn (needed if a new page is started) static QPtrList<TodoParentStart> startPoints; if (level<1) { startPoints.clear(); } // size of item outStr=item->summary(); if ( ! item->location().isEmpty() ) outStr += " ("+item->location()+")"; if ( item->hasDueDate() && posDueDt>=0 ) { outStr += " [" +local->formatDate(item->dtDue().date(),true)+"]"; } int left = possummary+(level*10); rect = p.boundingRect(left, y, (posdue-left-5),-1, WordBreak, outStr); - if ( !item->description().isEmpty() && !desc ) { + if ( !item->description().isEmpty() && desc ) { outStr = item->description(); rect = p.boundingRect( left+20, rect.bottom()+5, width-(left+10-x), -1, WordBreak, outStr ); } // if too big make new page if ( rect.bottom() > y+height) { // first draw the connection lines from parent todos: if (level > 0 && connectSubTodos) { TodoParentStart *rct; for ( rct = startPoints.first(); rct; rct = startPoints.next() ) { int start; int center = rct->mRect.left() + (rct->mRect.width()/2); int to = p.viewport().bottom(); // draw either from start point of parent or from top of the page if (rct->mSamePage) start = rct->mRect.bottom() + 1; else start = p.viewport().top(); p.moveTo( center, start ); p.lineTo( center, to ); rct->mSamePage=false; } } y=0; height=pageHeight-y; mPrinter->newPage(); } // If this is a sub-item, r will not be 0, and we want the LH side of the priority line up //to the RH side of the parent item's priority if (r && pospriority >= 0 ) { pospriority = r->mRect.right() + 1; } // Priority outStr.setNum(priority); rect = p.boundingRect(pospriority, y + 10, 5, -1, AlignCenter, outStr); // Make it a more reasonable size rect.setWidth(19); rect.setHeight(19); if ( priority > 0 && pospriority>=0 ) { p.drawText(rect, AlignCenter, outStr); p.drawRect(rect); // cross out the rectangle for completed items if ( item->isCompleted() ) { p.drawLine( rect.topLeft(), rect.bottomRight() ); p.drawLine( rect.topRight(), rect.bottomLeft() ); diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 2de7f28..006a8dd 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp @@ -788,111 +788,111 @@ void MainWindow::initActions() mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); mMoveAction->addTo( actionMenu ); connect( mMoveAction, SIGNAL( activated() ), mView, SLOT( moveIncidence() ) ); mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); mBeamAction->addTo( actionMenu ); connect( mBeamAction, SIGNAL( activated() ), mView, SLOT( beamIncidence() ) ); mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); mCancelAction->addTo( actionMenu ); connect( mCancelAction, SIGNAL( activated() ), mView, SLOT( toggleCancelIncidence() ) ); actionMenu->insertSeparator(); action = new QAction( "purge_completed", i18n("Purge Completed"), 0, this ); action->addTo( actionMenu ); connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); icon = loadPixmap( pathString + "search" ); QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); search_action->addTo( actionMenu ); connect( search_action, SIGNAL( activated() ), mView->dialogManager(), SLOT( showSearchDialog() ) ); if ( KOPrefs::instance()->mShowFullMenu ) { actionMenu->insertSeparator(); actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); } // actionMenu->insertSeparator(); action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, this ); action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); action = new QAction( "import_quick", i18n("Import last file"), 0, this ); action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); importMenu->insertSeparator(); action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, this ); action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); -#ifndef DESKTOP_VERSION + //#ifndef DESKTOP_VERSION importMenu->insertSeparator(); action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, this ); action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); -#else + //#else #ifdef _OL_IMPORT_ importMenu->insertSeparator(); action = new QAction( "import_ol", i18n("Import from OL"), 0, this ); action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); #endif -#endif + //#endif importMenu->insertSeparator(); action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, this ); action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, this ); action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); importMenu->insertSeparator(); action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, this ); action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); //LR QPopupMenu *ex2phone = new QPopupMenu( this ); ex2phone->insertItem(i18n("Complete calendar..."), 1 ); ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); importMenu->insertItem( i18n("Export to phone"), ex2phone ); importMenu->insertSeparator(); action = new QAction( "manage cat", i18n("Manage new categories..."), 0, this ); action->addTo( importMenu ); connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); #ifndef DESKTOP_VERSION importMenu->insertSeparator(); brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, this ); brAction->addTo( importMenu ); brAction->setToggleAction (true ) ; connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, this ); action->addTo( importMenu ); connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, this ); action->addTo( importMenu ); connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); #else @@ -1464,108 +1464,117 @@ void MainWindow::processIncidenceSelection( Incidence *incidence ) mDeleteAction->setText( i18n("Delete Todo...") ); mNewSubTodoAction->setEnabled( true ); } else { mShowAction->setText( i18n("Show...") ); mShowAction->setText( i18n("Edit...") ); mShowAction->setText( i18n("Delete...") ); mNewSubTodoAction->setEnabled( false ); } } void MainWindow::enableIncidenceActions( bool enabled ) { mShowAction->setEnabled( enabled ); mEditAction->setEnabled( enabled ); mDeleteAction->setEnabled( enabled ); mCloneAction->setEnabled( enabled ); mMoveAction->setEnabled( enabled ); mBeamAction->setEnabled( enabled ); mCancelAction->setEnabled( enabled ); } void MainWindow::importOL() { #ifdef _OL_IMPORT_ KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); id->exec(); delete id; mView->updateView(); #endif } void MainWindow::importBday() { int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), i18n("Import!"), i18n("Cancel"), 0, 0, 1 ); if ( result == 0 ) { mView->importBday(); } } void MainWindow::importQtopia() { -#ifndef DESKTOP_VERSION - int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), - i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"), + //#ifndef DESKTOP_VERSION + QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"); +#ifdef DESKTOP_VERSION + mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml"); +#endif + int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, i18n("Import!"), i18n("Cancel"), 0, 0, 1 ); if ( result == 0 ) { +#ifndef DESKTOP_VERSION QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; +#else + QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; + QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; + QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; +#endif mView->importQtopia( categories, datebook, todolist ); } -#else +#if 0 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), i18n("Not supported \non desktop!\n"), i18n("Ok"), i18n("Cancel"), 0, 0, 1 ); #endif } void MainWindow::saveOnClose() { KOPrefs *p = KOPrefs::instance(); p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); p->mToolBarUp = iconToolBar->x() > width()/2 || iconToolBar->y() > height()/2; mView->writeSettings(); if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) save(); } void MainWindow::slotModifiedChanged( bool changed ) { if ( mBlockAtStartup ) return; int msec; // we store the changes after 1 minute, // and for safety reasons after 10 minutes again if ( !mSyncManager->blockSave() ) msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; else msec = 1000 * 600; mSaveTimer.start( msec, true ); // 1 minute qDebug("KO: Saving File in %d secs!", msec/1000); mCalendarModifiedFlag = true; } void MainWindow::saveStopTimer() { mSaveTimer.stop(); if (mSaveTimer.isActive() ) qDebug("ti active "); else qDebug("KO: Save timer stopped"); } void MainWindow::save() { if ( !mCalendarModifiedFlag ) { qDebug("KO: Calendar not modified. Nothing saved."); return; } |