summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagenda.cpp23
-rw-r--r--korganizer/koagendaview.cpp15
-rw-r--r--korganizer/kofilterview.cpp23
-rw-r--r--korganizer/kofilterview.h1
-rw-r--r--korganizer/koprefs.cpp6
-rw-r--r--korganizer/koprefs.h4
-rw-r--r--microkde/kglobalsettings.cpp9
-rw-r--r--microkde/kglobalsettings.h1
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
@@ -84,9 +84,9 @@ MarcusBains::MarcusBains(KOAgenda *_agenda,const char *name)
}
MarcusBains::~MarcusBains()
{
- delete minutes;
+ //delete minutes;
}
int MarcusBains::todayColumn()
{
@@ -150,12 +150,13 @@ void MarcusBains::updateLocation(bool recalculate)
int offs = (today==agenda->columns()-1) ? -4 : 0;
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);
}
////////////////////////////////////////////////////////////////////////////
@@ -441,9 +442,9 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
{
if ( mInvalidPixmap ) {
mInvalidPixmap = false;
- qDebug("InvalidPixmap ");
+ qDebug("KO: Upsizing Pixmaps ");
computeSizes();
emit updateViewSignal();
return true;
}
@@ -1275,9 +1276,9 @@ void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch)
return;
if ( mInvalidPixmap ) {
mInvalidPixmap = false;
- qDebug("InvalidPixmap ");
+ qDebug("KO: Upsizing Pixmaps ");
computeSizes();
emit updateViewSignal();
return;
}
@@ -1416,9 +1417,9 @@ void KOAgenda::finishUpdate()
globalFlagBlockAgendaItemPaint = 0;
for ( item=mItems.first(); item != 0; item=mItems.next() ) {
item->repaint( false );
}
-
+ marcus_bains();
}
/*
Draw grid in the background of the agenda.
@@ -1799,9 +1800,8 @@ KOAgendaItem *KOAgenda::insertItem (Incidence *event,QDate qd,int X,int YTop,int
placeSubCells(agendaItem);
//agendaItem->show();
- marcus_bains();
return agendaItem;
}
@@ -1872,10 +1872,8 @@ void KOAgenda::insertMultiItem (Event *event,QDate qd,int XBegin,int XEnd,
current->setMultiItem(setFirst,next,setLast);
current = next;
}
-
- marcus_bains();
}
//QSizePolicy KOAgenda::sizePolicy() const
@@ -1958,21 +1956,20 @@ void KOAgenda::computeSizes()
int ch = contentsHeight();
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);
}
@@ -2030,9 +2027,8 @@ void KOAgenda::updateConfig()
}
else {
mGridSpacingY = KOPrefs::instance()->mHourSize;
calculateWorkingHours();
- marcus_bains();
}
}
void KOAgenda::checkScrollBoundaries()
@@ -2123,9 +2119,8 @@ 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
@@ -75,9 +75,9 @@ extern int globalFlagBlockAgendaItemPaint;
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)
{
@@ -572,30 +572,32 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) :
//connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) );
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 ");
startIdleTimeout();
@@ -605,8 +607,9 @@ void KOAgendaView::slotIdleTimeout()
mAgenda->shrinkPixmap();
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
@@ -36,8 +36,9 @@
#include "kofilterview.h"
#include "koprefs.h"
#include <kiconloader.h>
#include <kglobal.h>
+#include <kglobalsettings.h>
#include <kcolorbutton.h>
#include <kmessagebox.h>
@@ -397,13 +398,27 @@ void KOCalEditView::addCal()
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;
}
@@ -413,9 +428,11 @@ int KOCalEditView::addCalendar( QString name, QString file, bool ask )
fileIn.close();
}
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();
QTimer::singleShot( 0, this, SLOT ( readConfig() ) );
diff --git a/korganizer/kofilterview.h b/korganizer/kofilterview.h
index 4322299..be7b5b6 100644
--- a/korganizer/kofilterview.h
+++ b/korganizer/kofilterview.h
@@ -88,8 +88,9 @@ void checkValid() {
return;
}
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
@@ -453,20 +453,24 @@ void KOPrefs::usrReadConfig()
QString prefix = "Cal_" +QString::number( mNextAvailableCalendar );
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" );
}
//qDebug("NAME %s %s", kkf->mName.latin1(), i18n("Birthdays").latin1() );
if ( kkf->mName == i18n("Birthdays") ) {
kkf->mFileName = locateLocal( "data", "korganizer/birthdays.ics" );
}
+ if ( kkf->isRelative )
+ kkf->mFileName = KGlobalSettings::calendarDir() + kkf->mSavedFileName;
}
KPimPrefs::usrReadConfig();
}
@@ -551,10 +555,12 @@ void KOPrefs::usrWriteConfig()
fc.writeEntry( prefix+"_isStandard", kkf->isStandard );
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
@@ -53,19 +53,23 @@ class KopiCalendarFile : public QObject
isAlarmEnabled = true;
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;
bool isAlarmEnabled;
bool isReadOnly;
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
@@ -62,8 +62,17 @@ QString KGlobalSettings::backupDataDir()
dir = dir.left ( dir.length() - 5);
}
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()
{
return QApplication::font();
diff --git a/microkde/kglobalsettings.h b/microkde/kglobalsettings.h
index 4e4d87c..977e5b6 100644
--- a/microkde/kglobalsettings.h
+++ b/microkde/kglobalsettings.h
@@ -21,8 +21,9 @@ class KGlobalSettings
static void setAlternateBackgroundColor(QColor);
static QRect desktopGeometry( QWidget * );
static QString timeTrackerDir();
static QString backupDataDir();
+ static QString calendarDir();
/**
* Returns whether KDE runs in single (default) or double click
* mode.