-rw-r--r-- | korganizer/koagenda.cpp | 23 | ||||
-rw-r--r-- | korganizer/koagendaview.cpp | 15 | ||||
-rw-r--r-- | korganizer/kofilterview.cpp | 23 | ||||
-rw-r--r-- | korganizer/kofilterview.h | 1 | ||||
-rw-r--r-- | korganizer/koprefs.cpp | 6 | ||||
-rw-r--r-- | korganizer/koprefs.h | 4 | ||||
-rw-r--r-- | microkde/kglobalsettings.cpp | 9 | ||||
-rw-r--r-- | microkde/kglobalsettings.h | 1 |
8 files changed, 59 insertions, 23 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index 662576f..92c1cd6 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp @@ -85,7 +85,7 @@ MarcusBains::MarcusBains(KOAgenda *_agenda,const char *name) MarcusBains::~MarcusBains() { - delete minutes; + //delete minutes; } int MarcusBains::todayColumn() @@ -151,10 +151,11 @@ void MarcusBains::updateLocation(bool recalculate) agenda->moveChild(mTimeBox, x+agenda->gridSpacingX()-mTimeBox->width()+offs-1, y-mTimeBox->height()); - mTimeBox->raise(); //mTimeBox->setAutoMask(true); - minutes->start(5000,true); + int secs = QTime::currentTime().second(); + qDebug("second %d ", secs ); + minutes->start( (60 - secs +1)*1000 ,true); } @@ -442,7 +443,7 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) if ( mInvalidPixmap ) { mInvalidPixmap = false; - qDebug("InvalidPixmap "); + qDebug("KO: Upsizing Pixmaps "); computeSizes(); emit updateViewSignal(); return true; @@ -1276,7 +1277,7 @@ void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch) if ( mInvalidPixmap ) { mInvalidPixmap = false; - qDebug("InvalidPixmap "); + qDebug("KO: Upsizing Pixmaps "); computeSizes(); emit updateViewSignal(); return; @@ -1417,7 +1418,7 @@ void KOAgenda::finishUpdate() for ( item=mItems.first(); item != 0; item=mItems.next() ) { item->repaint( false ); } - + marcus_bains(); } /* @@ -1800,7 +1801,6 @@ KOAgendaItem *KOAgenda::insertItem (Incidence *event,QDate qd,int X,int YTop,int //agendaItem->show(); - marcus_bains(); return agendaItem; } @@ -1873,8 +1873,6 @@ void KOAgenda::insertMultiItem (Event *event,QDate qd,int XBegin,int XEnd, current->setMultiItem(setFirst,next,setLast); current = next; } - - marcus_bains(); } @@ -1959,19 +1957,18 @@ void KOAgenda::computeSizes() if ( mAllDayMode ) { QPixmap* paintPixAll = KOAgendaItem::paintPixAllday(); if ( (paintPixAll->width() < cw || paintPixAll->height() < ch) && cw > 0 && ch > 0 ) { - qDebug("paintPixAll->resize "); + //qDebug("paintPixAll->resize "); paintPixAll->resize( cw, ch ); } } else { QPixmap* paintPix = KOAgendaItem::paintPix(); if ( paintPix->width() < cw || paintPix->height() < ch ) { - qDebug("paintPix->resize "); + //qDebug("paintPix->resize "); paintPix->resize( cw , ch ); } } checkScrollBoundaries(); - marcus_bains(); drawContentsToPainter(); viewport()->repaint(false); } @@ -2031,7 +2028,6 @@ void KOAgenda::updateConfig() else { mGridSpacingY = KOPrefs::instance()->mHourSize; calculateWorkingHours(); - marcus_bains(); } } @@ -2124,7 +2120,6 @@ DateList KOAgenda::dateList() const void KOAgenda::setDateList(const DateList &selectedDates) { mSelectedDates = selectedDates; - marcus_bains(); } void KOAgenda::setHolidayMask(QMemArray<bool> *mask) diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 1b21a71..ef5c4dd 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp @@ -76,7 +76,7 @@ extern int globalFlagBlockAgendaItemUpdate; extern int globalFlagBlockLabel; using namespace KOrg; -#define IDLETIMEOUT 15 +#define IDLETIMEOUT 45 TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,WFlags f) : QScrollView(parent,name,f) @@ -573,28 +573,30 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : connect( mAllDayAgenda, SIGNAL( signalClearSelection() ),mAgenda, SLOT( slotClearSelection()) ); connect( mAgenda, SIGNAL( signalClearSelection() ),mAllDayAgenda, SLOT( slotClearSelection()) ); +#ifndef DESKTOP_VERSION connect( mAllDayAgenda, SIGNAL( updateViewSignal() ),this, SLOT( fillAgenda()) ); connect( mAgenda, SIGNAL( updateViewSignal() ), this, SLOT( fillAgenda()) ); - connect( mAllDayAgenda, SIGNAL( sendPing() ),this, SLOT( startIdleTimeout()) ); connect( mAgenda, SIGNAL( sendPing() ), this, SLOT( startIdleTimeout()) ); - - mIdleTimer = new QTimer ( this );; connect(mIdleTimer,SIGNAL(timeout()),SLOT(slotIdleTimeout())); +#endif } void KOAgendaView::startIdleTimeout() { +#ifndef DESKTOP_VERSION mIdleStart = QDateTime::currentDateTime(); mIdleTimer->start( IDLETIMEOUT * 1000 ); +#endif } void KOAgendaView::slotIdleTimeout() { - qDebug("SECS TO %d ",mIdleStart.secsTo( QDateTime::currentDateTime() ) ); +#ifndef DESKTOP_VERSION + //qDebug("SECS TO %d ",mIdleStart.secsTo( QDateTime::currentDateTime() ) ); int secsfromstart = mIdleStart.secsTo( QDateTime::currentDateTime() ); mIdleTimer->stop(); bool isActice = topLevelWidget()->isActiveWindow(); - qDebug("KO: Active Window %d %d", isActice, isVisible()); + //qDebug("KO: Active Window %d %d", isActice, isVisible()); // we do nothing if we wake up from a suspend if ( secsfromstart > IDLETIMEOUT + 30 && isActice ) { qDebug("KO: Wakeup from suspend "); @@ -606,6 +608,7 @@ void KOAgendaView::slotIdleTimeout() mAllDayAgenda->shrinkPixmap(); KOAgendaItem::paintPix()->resize( 20,20); KOAgendaItem::paintPixAllday()->resize( 20,20); +#endif } void KOAgendaView::toggleAllDay() diff --git a/korganizer/kofilterview.cpp b/korganizer/kofilterview.cpp index ff80afc..7ce3f1f 100644 --- a/korganizer/kofilterview.cpp +++ b/korganizer/kofilterview.cpp @@ -37,6 +37,7 @@ #include "koprefs.h" #include <kiconloader.h> #include <kglobal.h> +#include <kglobalsettings.h> #include <kcolorbutton.h> #include <kmessagebox.h> @@ -398,11 +399,25 @@ int KOCalEditView::addCalendar( QString name, QString file, bool ask ) { QFileInfo fi ( file ); + QString absFile = file; + bool isRelative = false; + if ( fi.isRelative() ) { + isRelative = true; + absFile = KGlobalSettings::calendarDir()+file; + fi.setFile( absFile ); + } else { + QString cd = KGlobalSettings::calendarDir(); + if ( file.left( cd.length() ) == cd ) { + isRelative = true; + file = fi.fileName (); + fi.setFile( absFile ); + } + } if (!fi.exists() ) { if ( ask ) - if ( KMessageBox::questionYesNo(this, i18n("The file\n%1\ndoes not exist!\nShall I create it for you?").arg( file ) )== KMessageBox::No ) + if ( KMessageBox::questionYesNo(this, i18n("The file\n%1\ndoes not exist!\nShall I create it for you?").arg( KGlobal::formatMessage (absFile,0) ) )== KMessageBox::No ) return 0; - QFile fileIn( file ); + QFile fileIn( absFile ); if (!fileIn.open( IO_WriteOnly ) ) { KMessageBox::sorry( this, i18n("Sorry, cannot create the file\n%1!\nNo calendar added!").arg( file ) ); return 0; @@ -414,7 +429,9 @@ int KOCalEditView::addCalendar( QString name, QString file, bool ask ) } KopiCalendarFile * kkf = KOPrefs::instance()->getNewCalendar(); kkf->mName = name; - kkf->mFileName = file; + kkf->mFileName = absFile; + kkf->mSavedFileName = file; + kkf->isRelative = isRelative; emit calendarAdded( kkf->mCalNumber ); if ( ask ) emit needsUpdate(); diff --git a/korganizer/kofilterview.h b/korganizer/kofilterview.h index 4322299..be7b5b6 100644 --- a/korganizer/kofilterview.h +++ b/korganizer/kofilterview.h @@ -89,6 +89,7 @@ void checkValid() { } if ( url->url().isEmpty() ) { KMessageBox::information( this, i18n("Sorry, the file name is empty!") ); + url->setURL( nameE->text() + ".ics" ); return; } accept(); diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index a886735..f1f1442 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp @@ -454,10 +454,12 @@ void KOPrefs::usrReadConfig() KopiCalendarFile *kkf = getNewCalendar(); kkf->isStandard = fc.readBoolEntry( prefix+"_isStandard", false ); kkf->isEnabled = fc.readBoolEntry( prefix+"_isEnabled", true); + kkf->isRelative = fc.readBoolEntry( prefix+"_isRelative", false ); kkf->isAlarmEnabled = fc.readBoolEntry( prefix+"_isAlarmEnabled", true); kkf->isReadOnly = fc.readBoolEntry( prefix+"_isReadOnly", false); kkf->mName = fc.readEntry( prefix+"_Name", "Calendar"); kkf->mFileName = fc.readEntry( prefix+"_FileName", kkf->mFileName); + kkf->mSavedFileName = fc.readEntry( prefix+"_SavedFileName", kkf->mFileName); kkf->mDefaultColor = fc.readColorEntry( prefix+"_Color",&mEventColor); if ( kkf->mCalNumber == 1 ) { kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" ); @@ -466,6 +468,8 @@ void KOPrefs::usrReadConfig() if ( kkf->mName == i18n("Birthdays") ) { kkf->mFileName = locateLocal( "data", "korganizer/birthdays.ics" ); } + if ( kkf->isRelative ) + kkf->mFileName = KGlobalSettings::calendarDir() + kkf->mSavedFileName; } KPimPrefs::usrReadConfig(); @@ -552,8 +556,10 @@ void KOPrefs::usrWriteConfig() fc.writeEntry( prefix+"_isEnabled", kkf->isEnabled ); fc.writeEntry( prefix+"_isAlarmEnabled", kkf->isAlarmEnabled ); fc.writeEntry( prefix+"_isReadOnly", kkf->isReadOnly ); + fc.writeEntry( prefix+"_isRelative", kkf->isRelative ); fc.writeEntry( prefix+"_Name", kkf->mName); fc.writeEntry( prefix+"_FileName", kkf->mFileName); + fc.writeEntry( prefix+"_SavedFileName", kkf->mSavedFileName); fc.writeEntry( prefix+"_Color",kkf->mDefaultColor); } kkf = mCalendars.next(); diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h index 7ec5327..0779e27 100644 --- a/korganizer/koprefs.h +++ b/korganizer/koprefs.h @@ -54,9 +54,11 @@ class KopiCalendarFile : public QObject isReadOnly = false; mName = "Calendar"; mFileName = QDir::homeDirPath() + "/icalfile.ics"; + mSavedFileName = "icalfile.ics"; mCalNumber = 0; mDefaultColor = Qt::red; mErrorOnLoad = false; + isRelative = false; } bool isStandard; bool isEnabled; @@ -65,6 +67,8 @@ class KopiCalendarFile : public QObject bool mErrorOnLoad; QString mName; QString mFileName; + QString mSavedFileName; + bool isRelative; int mCalNumber; QColor mDefaultColor; QDateTime mLoadDt; diff --git a/microkde/kglobalsettings.cpp b/microkde/kglobalsettings.cpp index 3f8a630..2e483e9 100644 --- a/microkde/kglobalsettings.cpp +++ b/microkde/kglobalsettings.cpp @@ -63,6 +63,15 @@ QString KGlobalSettings::backupDataDir() } return dir; } +QString KGlobalSettings::calendarDir() +{ + static QString dir; + if ( dir.isEmpty() ) { + dir = locateLocal( "data", "korganizer/d.ttl" ); + dir = dir.left ( dir.length() - 5); + } + return dir; +} QFont KGlobalSettings::toolBarFont() { diff --git a/microkde/kglobalsettings.h b/microkde/kglobalsettings.h index 4e4d87c..977e5b6 100644 --- a/microkde/kglobalsettings.h +++ b/microkde/kglobalsettings.h @@ -22,6 +22,7 @@ class KGlobalSettings static QRect desktopGeometry( QWidget * ); static QString timeTrackerDir(); static QString backupDataDir(); + static QString calendarDir(); /** * Returns whether KDE runs in single (default) or double click |