summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt2
-rw-r--r--kalarmd/simplealarmdaemonimpl.cpp4
-rw-r--r--korganizer/calendarview.cpp6
3 files changed, 8 insertions, 4 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt
index ec6a4ec..a11fab3 100644
--- a/bin/kdepim/WhatsNew.txt
+++ b/bin/kdepim/WhatsNew.txt
@@ -1,100 +1,102 @@
Info about the changes in new versions of KDE-Pim/Pi
********** VERSION 2.1.6 ************
KO/Pi:
Added to the list view (the list view is used in search dialog as well) the possibility to print it.
Added to the list view the possibility to hide entries, if you do not want to print all entries of the list view.
Added to the list view the possibility to add all subtodos of selected todos to an export/beam.
Added to the search dialog the possibility to make an additive search such that you can get a better list for export/printout.
+Added to the search dialog the possibility to hide the checkboxes such that there is more space for the list view on the Zaurus.
+Fixed a problem in the AlarmTimer Applet: Now utf8 messages are displayed properly.
********** VERSION 2.1.5 ************
This is the new stable version.
Bugfix:
Fixed a problem with agenda popup on the desktop in KO/Pi.
Fixed a crash when reloading file, e.g. after a passive pi-sync synchronization.
Added config option to not display completed todos in agenda view.
Addressee view is now using the formatted name, if defined.
That makes it possible to display "lastname, firstname" in that view now.
To set the formatted name for all contacts, please use menu:
Edit->Change->Set formatted name.
Fixed the bug in KA/Pi that is was not possible to add images to a contact on Windows.
********** VERSION 2.1.4 ************
Fixed two more bugs in the KA/Pi CSV import dialog:
Made it possible to read multi-line fields and import it to the "Note" field.
Fixed a problem in mapping custom fields, whatever a custem field is...
********** VERSION 2.1.3 ************
Changed the menu structure of the alarm applet:
Moved "Simulate" to " Play Beeps" submenu and re-added "Todo List".
Fixed several problems in the KA/Pi CSV import dialog:
Added "Category", made codec configureable and made it possible to map many fields to the "Note" field.
********** VERSION 2.1.2 ************
Fixed a problem closing the alarm dialog on Zaurus with "OK" button.
Fixed a problem when importing data from Outlook with mutiple categories set.
Changed display of days in datenavigator:
Birthdays are now blue, not dark green.
When todo view is shown, no birtdays are shown and days with due todos are shown blue.
When journal view is shown, only holidays are shown and days with journals are blue.
Added Backup options to global config:
You can create now x-daily backups for KO/Pi, KA/Pi (for file resources only, file resource is the standard type) and PwM/Pi ( all files you will open ).
It is recommended to use another HDD/Memory card for the backup directory. If (very useful on the Zaurus) the specified backup directory does not exist you are asked if you want to try again to create a backup. That makes it possible to insert your memory card in the Zaurus and then trying again.
The backup is created when the application wants to save for the first time on a backup-day. You can specify the amount of backups and the day interval of backups.
********** VERSION 2.1.1 ************
Stable release 2.1.1!
KO/Pi:
Fixed one problem in the layout of the edit dialogs on the Zaurus with 640x480 display.
********** VERSION 2.1.0 ************
Stable release 2.1.0!
Summary of changes/fixes compared to version 2.0.6:
Many bugs of version 2.0.6 fixed.
Most of them were small bugs, but some of them were important.
It is recommended to use version 2.1.0 and not version 2.0.6.
Important changes:
Added recurring todos to KO/Pi.
Added global application font settings (for all KDE-Pim/Pi apps) to the general settings.
Made Passwordmanager PwM/Pi more userfriendly: Rearranged some toolbar icons, optimized setting of focus, fixed layout problems and more.
Datenavigator can now display many months. Very useful on the desktop.
KO/Pi alarm applet changed: Made buttons in alarm dialog much bigger and other usebility enhancements.
Made alarm sound working on Linux desktop.
Made KO/Pi and KA/Pi running from a memory stick. Please read storage HowTo for details.
Added timetracking feature in KO/Pi todo view. Please read timetraker HowTo for details.
Many other usebility enhancements.
Special thanks to Ben for his suggestions!
You can find the complete changelog
from version 1.7.7 to 2.1.0
in the source package or on
http://www.pi-sync.net/html/changelog.html
diff --git a/kalarmd/simplealarmdaemonimpl.cpp b/kalarmd/simplealarmdaemonimpl.cpp
index 37e7d0d..d6e06c8 100644
--- a/kalarmd/simplealarmdaemonimpl.cpp
+++ b/kalarmd/simplealarmdaemonimpl.cpp
@@ -177,193 +177,193 @@ void SimpleAlarmDaemonImpl::saveSlot( int load )
if ( ok ) {
confPause( val );
}
}
if ( line.left(4 ) == "SUCO" ) {
val = line.mid( 4,len-5).toInt( &ok );
if ( ok )
confSuspend ( val );
}
if ( line.left(4 ) == "WAAL" ) {
val = line.mid( 4,len-5).toInt( &ok );
if ( ok )
confSound( val );
}
if ( line.left(4 ) == "PLBE" ) {
val = line.mid( 4,len-5).toInt( &ok );
if ( ok )
slotPlayBeep( val );
}
if ( line.left(4 ) == "CUTE" ) {
mCustomText = line.mid( 5,len-6);
// qDebug("text ***%s*** ",mCustomText.latin1() );
}
if ( line.left(4 ) == "CUMI" ) {
val = line.mid( 4,len-5).toInt( &ok );
if ( ok )
mCustomMinutes = val;
}
if ( line.left(4 ) == "SUTI" ) {
val = line.mid( 4,len-5).toInt( &ok );
if ( ok )
mAlarmDialog->setSuspendTime( val );;
}
}
file.close();
} else {
if (!file.open( IO_WriteOnly ) ) {
return;
}
QString configString ;
configString += "PPAU " + QString::number( mPausePlay ) + "\n";
configString += "SUCO " + QString::number( mSuspend ) + "\n";
configString += "WAAL " + QString::number( wavAlarm ) + "\n";
configString += "PLBE " + QString::number( mPlayBeeps ) + "\n";
configString += "CUTE " + mCustomText + "\n";
configString += "CUMI " + QString::number( mCustomMinutes ) + "\n";
configString += "SUTI " + QString::number( mAlarmDialog->getSuspendTime( )) + "\n";
QTextStream ts( &file );
ts << configString ;
file.close();
}
}
void SimpleAlarmDaemonImpl::confSuspend( int num )
{
mSuspendPopUp->setItemChecked ( mSuspend,false );
mSuspend = num;
mSuspendPopUp->setItemChecked ( mSuspend,true );
}
void SimpleAlarmDaemonImpl::confPause( int num )
{
mPausePopUp->setItemChecked ( mPausePlay,false );
mPausePlay = num;
mPausePopUp->setItemChecked ( mPausePlay,true );
}
void SimpleAlarmDaemonImpl::confSound( int num )
{
if ( num == 0 ) {
wavAlarm = false;
mSoundPopUp->setItemChecked ( 0, true );
mSoundPopUp->setItemChecked ( 1, false );
} else {
wavAlarm = true;
mSoundPopUp->setItemChecked ( 0, false );
mSoundPopUp->setItemChecked ( 1, true );
}
}
void SimpleAlarmDaemonImpl::slotPlayBeep( int num )
{
if ( num == 1000 ) {
simulate();
return;
}
mBeepPopUp->setItemChecked ( mPlayBeeps,false );
mPlayBeeps = num;
mBeepPopUp->setItemChecked ( mPlayBeeps, true );
}
void SimpleAlarmDaemonImpl::recieve( const QCString& msg, const QByteArray& )
{
//qDebug("SimpleAlarmDaemonImpl::ALARM RECEIVED! %s", msg.data());
- QString mess = msg;
+ QString mess = QString::fromUtf8(msg.data());
mAlarmMessage = mess.mid( 9 );
QString filename = getenv("QPEDIR") ;
filename += "/pics/kdepim/korganizer/koalarm.wav";
QString tempfilename;
if ( mess.left( 13 ) == "suspend_alarm") {
bool error = false;
int len = mess.mid( 13 ).find("+++");
if ( len < 2 )
error = true;
else {
tempfilename = mess.mid( 13, len );
if ( !QFile::exists( tempfilename ) )
error = true;
}
if ( ! error ) {
filename = tempfilename;
}
mAlarmMessage = mess.mid( 13+len+3 );
//qDebug("suspend file %s ",tempfilename.latin1() );
startAlarm( mAlarmMessage, filename);
return;
}
if ( mess.left( 11 ) == "timer_alarm") {
mTimerTime = 0;
startAlarm( mess.mid( 11 ), filename );
return;
}
if ( mess.left( 10 ) == "proc_alarm") {
bool error = false;
int len = mess.mid( 10 ).find("+++");
if ( len < 2 )
error = true;
else {
tempfilename = mess.mid( 10, len );
if ( !QFile::exists( tempfilename ) )
error = true;
}
if ( error ) {
mAlarmMessage = "Procedure Alarm\nError - File not found\n";
mAlarmMessage += mess.mid( 10+len+3+9 );
} else {
{
QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent");
}
//qDebug("-----system command %s ",tempfilename.latin1() );
if ( vfork () == 0 ) {
execl ( tempfilename.latin1(), 0 );
return;
}
return;
}
//qDebug("+++++++system command %s ",tempfilename.latin1() );
}
if ( mess.left( 11 ) == "audio_alarm") {
bool error = false;
int len = mess.mid( 11 ).find("+++");
if ( len < 2 )
error = true;
else {
tempfilename = mess.mid( 11, len );
if ( !QFile::exists( tempfilename ) )
error = true;
}
if ( ! error ) {
filename = tempfilename;
}
mAlarmMessage = mess.mid( 11+len+3+9 );
//qDebug("audio file command %s ",tempfilename.latin1() );
}
if ( mess.left( 9 ) == "cal_alarm") {
mAlarmMessage = mess.mid( 9 ) ;
}
writeFile();
startAlarm( mAlarmMessage, filename );
}
int SimpleAlarmDaemonImpl::getFileNameLen( QString mess )
{
return 0;
}
void SimpleAlarmDaemonImpl::startAlarm( QString mess, QString filename )
{
//mAlarmDialog->show();
//mAlarmDialog->raise();
mAlarmDialog->eventNotification( mess, mPlayBeeps, filename, wavAlarm,mPausePlay ,mSuspend );
}
void SimpleAlarmDaemonImpl::fillTimerPopUp()
{
// qDebug(" timer %d %d ",mTimerPopupConf, mTimerTime );
if ( mTimerPopupConf == mTimerTime ) {
@@ -529,168 +529,168 @@ void SimpleAlarmDaemonImpl::confTimer( int time )
mRunningTimerText = "Tea";
}
else if ( minutes == 3 ) {
mess += mCustomText;
minutes = mCustomMinutes ;
mRunningTimerText = mCustomText.stripWhiteSpace ();
int in = mRunningTimerText.find( " " );
mRunningTimerText = mRunningTimerText.left ( in );
}
else {
if ( minutes == 2 ) {
// ask time
QDialog dia ( 0, ("Customize Timer" ), true );
QLabel lab (("Message Text:"), &dia );
dia.setCaption(("KO/Pi Timer" ));
QVBoxLayout lay( &dia );
lay.setMargin(5);
lay.setSpacing(5);
lay.addWidget( &lab);
QLineEdit lEdit( mCustomText, &dia );
lay.addWidget( &lEdit);
QLabel lab2 (("Countdown time (1 min - 24 h):"), &dia );
lay.addWidget( &lab2);
QHBox hbox1 ( &dia );
lay.addWidget( &hbox1);
QLabel lab3 (("Hours"), &hbox1 );
QLabel lab4 (("Minutes"), &hbox1 );
QHBox hbox ( &dia );
QSpinBox spinh( 0, 24, 1,& hbox );
QFont fo = dia.font();
fo.setPointSize( 36 );
QSpinBox spinm( 0, 59, 1,&hbox );
spinm.setFont( fo );
spinh.setFont( fo );
spinh.setButtonSymbols( QSpinBox::PlusMinus );
spinm.setButtonSymbols( QSpinBox::PlusMinus );
spinh.upButton ()->setFixedSize( QSize( 48, 30 ));
spinh.downButton ()->setFixedSize( QSize( 48, 30 ));
//spinh.editor ()->setFixedSize( QSize( 50, 100 ));
spinh.setFixedSize( 100,62 );
spinm.upButton ()->setFixedSize( QSize( 48, 30 ));
spinm.downButton ()->setFixedSize( QSize( 48, 30 ));
spinm.downButton ()->setGeometry( 50,50,50,50);
// spinm.setSuffix( " m" );
//spinh.setSuffix( " h" );
spinm.setWrapping ( true );
//spinm.editor ()->setFixedSize( QSize( 50, 100 ));
spinm.setLineStep( 1 );
spinm.setFixedSize( 110,62 );
lay.addWidget( &hbox);
QLabel lab5 ("Timer fires at:", &dia );
lab5.setAlignment( AlignCenter );
lay.addWidget( &lab5);
KODateLabel dl ( &dia );
dl.setAlignment( AlignCenter );
dl.setFont( fo );
connect ( &spinh, SIGNAL ( valueChanged (int)), &dl, SLOT ( slot_hours( int ) ) );
connect ( &spinm, SIGNAL ( valueChanged (int)), &dl, SLOT ( slot_minutes( int ) ) );
lay.addWidget( &dl);
spinh.setValue( mCustomMinutes/60 );
spinm.setValue( mCustomMinutes%60 );
QPushButton ok ( "Start timer", &dia);
ok.setDefault( true );
ok.setFont( fo );
spinh.setFocus();
lay.addWidget( &ok);
connect ( &ok, SIGNAL (clicked()), &dia, SLOT ( accept() ) );
dia.resize( dia.sizeHint().width(), dia.sizeHint().height() );
if ( !dia.exec() )
return;
mCustomText = lEdit.text();
mCustomMinutes = spinh.value()*60+spinm.value();
if ( mCustomMinutes == 0 )
mCustomMinutes = 1;
if ( mCustomMinutes > 1440 )
mCustomMinutes = 1440;
mess += mCustomText;
minutes = mCustomMinutes;
mRunningTimerText = mCustomText.stripWhiteSpace ();
int in = mRunningTimerText.find( " " );
mRunningTimerText = mRunningTimerText.left ( in );
}
else {
mess+= QString::number ( minutes ) + ( " minutes are past!");
int min = minutes;
if ( min % 60 == 0 )
mRunningTimerText = QString::number ( min/60 ) + ( " hours");
else
mRunningTimerText = QString::number ( minutes ) + ( " minutes");
}
}
//minutes = 1;
mRunningTimer = QDateTime::currentDateTime().addSecs( minutes * 60 );
timerMesssage = mess;
- AlarmServer::addAlarm ( mRunningTimer,"koalarm",timerMesssage.latin1());
+ AlarmServer::addAlarm ( mRunningTimer,"koalarm",timerMesssage.utf8());
mTimerTime = 1;
}
void SimpleAlarmDaemonImpl::writeFile()
{
QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent");
//QCopEnvelope e("QPE/Application/kopi", "-writeFile");
}
void SimpleAlarmDaemonImpl::showWN()
{
QCopEnvelope e("QPE/Application/kopi", "-showWN");
}
void SimpleAlarmDaemonImpl::newTodo()
{
QCopEnvelope e("QPE/Application/kopi", "-newTodo");
}
void SimpleAlarmDaemonImpl::newEvent()
{
QCopEnvelope e("QPE/Application/kopi", "-newEvent");
}
void SimpleAlarmDaemonImpl::newMail()
{
QCopEnvelope e("QPE/Application/ompi", "newMail()");
}
void SimpleAlarmDaemonImpl::showAdd()
{
QCopEnvelope e("QPE/Application/kapi", "raise()");
}
void SimpleAlarmDaemonImpl::ringSync()
{
QCopEnvelope e("QPE/Application/kopi", "-ringSync");
}
void SimpleAlarmDaemonImpl::newCountdown()
{
//recieve("cal_alarm", 10 );
}
void SimpleAlarmDaemonImpl::simulate()
{
writeFile();
QString filename = getenv("QPEDIR") ;
filename += "/pics/kdepim/korganizer/koalarm.wav";
startAlarm("Alarm simulation", filename );
}
void SimpleAlarmDaemonImpl::showKO()
{
QCopEnvelope e("QPE/Application/kopi", "-showKO");
// testing only
//QCopEnvelope e("QPE/Application/kopi", "nextView()");
}
void SimpleAlarmDaemonImpl::showTodo()
{
QCopEnvelope e("QPE/Application/kopi", "-showTodo");
}
void SimpleAlarmDaemonImpl::writeJournal()
{
QCopEnvelope e("QPE/Application/kopi", "-showJournal");
}
void SimpleAlarmDaemonImpl::mousePressEvent( QMouseEvent * )
{
mPopUp->popup(mapToGlobal(QPoint (0, -mPopUp->height() )));
}
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 8d992b9..4b82aa8 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -557,375 +557,377 @@ void CalendarView::init()
this, SLOT (cancelIncidence( Incidence * ) ) );
connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ),
this, SLOT ( moveIncidence( Incidence * ) ) );
connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ),
this, SLOT ( beamIncidence( Incidence * ) ) );
connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ),
this, SLOT ( todo_unsub( Todo * ) ) );
connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ),
this, SLOT ( todo_resub( Todo *,Todo * ) ) );
connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList,
SLOT( updateTodo( Todo *, int ) ) );
connect( this, SIGNAL( todoModified( Todo *, int )), this,
SLOT( changeTodoDisplay( Todo *, int ) ) );
connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) );
connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) );
connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) );
connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) );
connect(QApplication::clipboard(),SIGNAL(dataChanged()),
SLOT(checkClipboard()));
connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ),
SLOT( processTodoListSelection( Incidence * ) ) );
connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool)));
// kdDebug() << "CalendarView::CalendarView() done" << endl;
mDateFrame = new QVBox(0,0,WType_Popup);
//mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised);
mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised );
mDateFrame->setLineWidth(3);
mDateFrame->hide();
mDateFrame->setCaption( i18n( "Pick a date to display"));
mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() );
connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate)));
mEventEditor = mDialogManager->getEventEditor();
mTodoEditor = mDialogManager->getTodoEditor();
mFlagEditDescription = false;
mSuspendTimer = new QTimer( this );
mAlarmTimer = new QTimer( this );
mRecheckAlarmTimer = new QTimer( this );
connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) );
connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) );
connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) );
mAlarmDialog = new AlarmDialog( this );
connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) );
mAlarmDialog->setServerNotification( false );
mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime );
#ifndef DESKTOP_VERSION
//US listen for arriving address resultsets
connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)),
this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)));
#endif
mDateNavigator->setCalendar( mCalendar );
}
CalendarView::~CalendarView()
{
// kdDebug() << "~CalendarView()" << endl;
//qDebug("CalendarView::~CalendarView() ");
delete mDialogManager;
delete mViewManager;
delete mStorage;
delete mDateFrame ;
delete beamDialog;
delete mEventViewerDialog;
//kdDebug() << "~CalendarView() done" << endl;
}
void CalendarView::checkAlarms()
{
KConfig *config = KOGlobals::config();
config->setGroup( "AppRun" );
QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) );
int secto = dt.secsTo( QDateTime::currentDateTime() );
int secs = config->readNumEntry( "LatestProgramStop" , secto) - 30;
//secs -= ( 3600 * 24*3 ); // debug only
QDateTime latest = dt.addSecs ( secs );
qDebug("KO: Last termination on %s ", latest.toString().latin1());
QPtrList<Incidence> el = mCalendar->rawIncidences();
QPtrList<Incidence> al;
Incidence* inL = el.first();
+ QDateTime cur = QDateTime::currentDateTime().addSecs(-59);
+ qDebug("KO: Checking alarm until %s ", cur.toString().latin1());
while ( inL ) {
bool ok = false;
int offset = 0;
QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ;
if ( ok ) {
//qDebug("OK %s",next.toString().latin1());
- if ( next < QDateTime::currentDateTime() ) {
+ if ( next < cur ) {
al.append( inL );
//qDebug("found missed alarm: %s ", inL->summary().latin1() );
}
}
inL = el.next();
}
if ( al.count() ) {
QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop );
dia->setCaption( i18n("KO/Pi: Missing alarms!") );
QVBoxLayout* lay = new QVBoxLayout( dia );
lay->setSpacing( 0 );
lay->setMargin( 0 );
MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest );
connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) ));
lay->addWidget( matb );
if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) {
int wid = 210;
int x = QApplication::desktop()->width() - wid - 7;
int y = QApplication::desktop()->height() - wid - 70;
dia->setGeometry ( x,y,wid,wid);
} else {
int si = 220;
if ( QApplication::desktop()->width() > 470 )
si = 400;
dia->resize(si,si/2);
}
dia->setBackgroundColor( QColor( 255, 255, 255 ) );
dia->show();
}
}
void CalendarView::showDay( QDate d )
{
dateNavigator()->blockSignals( true );
dateNavigator()->selectDate( d );
dateNavigator()->blockSignals( false );
mViewManager->showDayView();
//dateNavigator()->selectDate( d );
}
void CalendarView::timerAlarm()
{
//qDebug("CalendarView::timerAlarm() ");
computeAlarm(mAlarmNotification );
}
void CalendarView::suspendAlarm()
{
//qDebug(" CalendarView::suspendAlarm() ");
computeAlarm(mSuspendAlarmNotification );
}
void CalendarView::startAlarm( QString mess , QString filename)
{
topLevelWidget()->showNormal();
topLevelWidget()->setActiveWindow();
topLevelWidget()->raise();
mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount );
QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) );
}
void CalendarView::checkNextTimerAlarm()
{
mCalendar->checkAlarmForIncidence( 0, true );
}
void CalendarView::computeAlarm( QString msg )
{
QString mess = msg;
QString mAlarmMessage = mess.mid( 9 );
QString filename = MainWindow::resourcePath();
filename += "koalarm.wav";
QString tempfilename;
if ( mess.left( 13 ) == "suspend_alarm") {
bool error = false;
int len = mess.mid( 13 ).find("+++");
if ( len < 2 )
error = true;
else {
tempfilename = mess.mid( 13, len );
if ( !QFile::exists( tempfilename ) )
error = true;
}
if ( ! error ) {
filename = tempfilename;
}
mAlarmMessage = mess.mid( 13+len+3 );
//qDebug("suspend file %s ",tempfilename.latin1() );
startAlarm( mAlarmMessage, filename);
return;
}
if ( mess.left( 11 ) == "timer_alarm") {
//mTimerTime = 0;
startAlarm( mess.mid( 11 ), filename );
return;
}
if ( mess.left( 10 ) == "proc_alarm") {
bool error = false;
int len = mess.mid( 10 ).find("+++");
if ( len < 2 )
error = true;
else {
tempfilename = mess.mid( 10, len );
if ( !QFile::exists( tempfilename ) )
error = true;
}
if ( error ) {
mAlarmMessage = "Procedure Alarm\nError - File not found\n";
mAlarmMessage += mess.mid( 10+len+3+9 );
} else {
//QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent");
//qDebug("-----system command %s ",tempfilename.latin1() );
#ifndef _WIN32_
if ( vfork () == 0 ) {
execl ( tempfilename.latin1(), 0 );
return;
}
#else
QProcess* p = new QProcess();
p->addArgument( tempfilename.latin1() );
p->start();
return;
#endif
return;
}
//qDebug("+++++++system command %s ",tempfilename.latin1() );
}
if ( mess.left( 11 ) == "audio_alarm") {
bool error = false;
int len = mess.mid( 11 ).find("+++");
if ( len < 2 )
error = true;
else {
tempfilename = mess.mid( 11, len );
if ( !QFile::exists( tempfilename ) )
error = true;
}
if ( ! error ) {
filename = tempfilename;
}
mAlarmMessage = mess.mid( 11+len+3+9 );
//qDebug("audio file command %s ",tempfilename.latin1() );
}
if ( mess.left( 9 ) == "cal_alarm") {
mAlarmMessage = mess.mid( 9 ) ;
}
startAlarm( mAlarmMessage, filename );
}
void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString &noti )
{
//qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
mSuspendAlarmNotification = noti;
int ms = QDateTime::currentDateTime().secsTo( qdt )*1000;
//qDebug("Suspend Alarm timer started with secs: %d ", ms/1000);
mSuspendTimer->start( ms , true );
}
void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti )
{
mNextAlarmDateTime = qdt;
//qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
#ifndef DESKTOP_VERSION
- AlarmServer::addAlarm ( qdt,"koalarm", noti.latin1() );
+ AlarmServer::addAlarm ( qdt,"koalarm", noti.utf8() );
#endif
return;
}
int maxSec;
//maxSec = 5; //testing only
maxSec = 86400+3600; // one day+1hour
mAlarmNotification = noti;
int sec = QDateTime::currentDateTime().secsTo( qdt );
if ( sec > maxSec ) {
mRecheckAlarmTimer->start( maxSec * 1000 );
// qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec );
return;
} else {
mRecheckAlarmTimer->stop();
}
//qDebug("Alarm timer started with secs: %d ", sec);
mAlarmTimer->start( sec *1000 , true );
}
// called by mRecheckAlarmTimer to get next alarm
// we need this, because a QTimer has only a max range of 25 days
void CalendarView::recheckTimerAlarm()
{
mAlarmTimer->stop();
mRecheckAlarmTimer->stop();
mCalendar->checkAlarmForIncidence( 0, true );
}
void CalendarView::removeAlarm(const QDateTime &qdt, const QString &noti )
{
//qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
#ifndef DESKTOP_VERSION
AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() );
#endif
return;
}
mAlarmTimer->stop();
}
void CalendarView::selectWeekNum ( int num )
{
dateNavigator()->blockSignals( true );
dateNavigator()->selectWeek( num );
dateNavigator()->blockSignals( false );
mViewManager->showWeekView();
}
KOViewManager *CalendarView::viewManager()
{
return mViewManager;
}
KODialogManager *CalendarView::dialogManager()
{
return mDialogManager;
}
QDate CalendarView::startDate()
{
DateList dates = mNavigator->selectedDates();
return dates.first();
}
QDate CalendarView::endDate()
{
DateList dates = mNavigator->selectedDates();
return dates.last();
}
void CalendarView::createPrinter()
{
#ifndef KORG_NOPRINTER
if (!mCalPrinter) {
mCalPrinter = new CalPrinter(this, mCalendar);
connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig()));
}
#endif
}
//KOPrefs::instance()->mWriteBackFile
//KOPrefs::instance()->mWriteBackExistingOnly
// 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict"));
// 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict"));
// 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict"));
// 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict"));
// 4 syncPrefsGroup->addRadio(i18n("Force take local entry always"));
// 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always"));
int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full )
{
// 0 equal
// 1 take local