From b170a7414ff72016285ea207caa7ccf786530e77 Mon Sep 17 00:00:00 2001 From: zautrix Date: Sun, 27 Mar 2005 09:46:04 +0000 Subject: many fixes --- diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index d4ec863..4250fb3 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt @@ -16,6 +16,18 @@ Many small usebility fixes in KO/Pi. Pressing the "Calendar" button on the Z switches now to the next view in KO/Pi. The set of possible "next views" are the views you have toolbar buttons for. +Made alarm sound working on Linux. + +KO/Pi alarm applet changed: +Made buttons in alarm dialog much bigger. +Made setting of timer more user friendly by showing the actual timer fire time and making the buttons in the timer settings much bigger. +The goal was it to make it possible to use a finger tip ( and not the stylus ) on the touchscreen to adjust the settings. + +And because this version is realeased at Easter, I added an Easter-egg: +With a new undocumented command you can get a message box about the next alarm. +Good luck to find it! + + ********** VERSION 2.0.20 ************ diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt index b6293b5..ce55780 100644 --- a/bin/kdepim/korganizer/germantranslation.txt +++ b/bin/kdepim/korganizer/germantranslation.txt @@ -1304,10 +1304,13 @@ { "Show current time","Zeige aktuelle Zeit" }, { "Edit new item","Bearbeite neuen Eintrag" }, { "Please select at least one\nof the types to search for:\n\nEvents\nTodos\nJournals","Bitte wählen Sie mindestens\neinen dieser Typen\num darin zu suchen:\n\nTermine\nTodos\nJournale" }, +{ "There is no next alarm.","Es gibt keinen nächsten Alarm." }, +{ "%1 %2 - %3 (next event/todo with alarm)","%1 %2 - %3 (nächster Termin/Todo mit Alarm)" }, +{ "The next alarm is on:\n%1\nat: %2\n\n%3\n(%4)","Der nächste Alarm in am:\n%1\num: %2\n\n%3\n(%4)" }, { "","" }, { "","" }, { "","" }, { "","" }, { "","" }, { "","" }, -{ "","" }, + \ No newline at end of file diff --git a/kalarmd/alarmdialog.cpp b/kalarmd/alarmdialog.cpp index c939ae0..7ead3b9 100644 --- a/kalarmd/alarmdialog.cpp +++ b/kalarmd/alarmdialog.cpp @@ -47,6 +47,7 @@ #include #include #include + #endif #include "alarmdialog.h" @@ -91,14 +92,16 @@ AlarmDialog::AlarmDialog(QWidget *parent,const char *name) layout->addWidget ( mMissedAlarms ); mMissedAlarmsCombo = new QComboBox ( this ); layout->addWidget ( mMissedAlarmsCombo ); - QVBox *suspendBox = new QVBox( this ); - suspendBox->setSpacing(3); - layout->addWidget ( suspendBox ); - QLabel* labb = new QLabel("Suspend duration (minutes):",suspendBox); + + QLabel* labb = new QLabel("Suspend duration (minutes):",this); labb->setAlignment(AlignCenter); + layout->addWidget ( labb ); fo = font(); - fo.setPointSize( 36 ); - mSuspendSpin = new QSpinBox(1,1440,1,suspendBox); + int pointSize = 36; + if ( QApplication::desktop()->width() <= 320 ) + pointSize = 24; + fo.setPointSize( pointSize ); + mSuspendSpin = new QSpinBox(1,1440,1,this); mSuspendSpin->setFont( fo ); mSuspendSpin->setValue(7); // default suspend duration mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus ); @@ -108,11 +111,17 @@ AlarmDialog::AlarmDialog(QWidget *parent,const char *name) mSuspendSpin->downButton ()->setFixedSize( QSize( 48, 30 )); #endif mSuspendSpin->setFixedSize( 100,62 ); - mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus ); + mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus ); + QHBoxLayout* layoutSpin = new QHBoxLayout( layout ); + layoutSpin->addStretch (); + layoutSpin->addWidget ( mSuspendSpin ); + layoutSpin->addStretch (); QVBox * bbox = new QVBox ( this ); layout->addWidget ( bbox ); bbox->layout()->setSpacing( 2 ); + labb = new QLabel("Press \"Cancel\" or \"Esc\" to suspend!",bbox); + labb->setAlignment(AlignCenter); mSuspendButton = new QPushButton( "Suspend", bbox); QPushButton* silen = new QPushButton( " Stop sound ", bbox); QPushButton* okbut = new QPushButton( "Ok", bbox); @@ -259,15 +268,38 @@ void AlarmDialog::playSound () qApp->processEvents(); if ( alarmCounter < maxAlarmReplay && ! mSilent) { ++alarmCounter; +#ifdef DESKTOP_VERSION + mPlayWav = true; +#endif if ( !mPlayWav || mFileName.length() < 2 ) { -#ifndef DESKTOP_VERSION +#ifdef DESKTOP_VERSION + qDebug("Sound play not possible - file not found"); +#else Sound::soundAlarm (); #endif - } else { + } else + + { +#ifdef DESKTOP_VERSION +#ifdef _WIN32_ + QSound::play ( mFileName ); +#else + + QString command = "playwave -r 22050 " + mFileName; + qDebug("KO: Playing file %s with 22kHz",mFileName.latin1() ); + int ret = system ( command.latin1() ); + if ( ret != 0 ) { + qDebug("Sound play command failed: %s ",command.latin1() ); + } + +#endif + +#else QSound::play ( mFileName ); +#endif //qDebug("BEEP!"); - } + } } else { if ( ! mSilent && mSuspendCounter > 0 ) { --mSuspendCounter; diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 3a16fe6..73aa733 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -235,7 +235,7 @@ CalendarView::CalendarView( Calendar *calendar, void CalendarView::init() { - + mNextAlarmDateTime = QDateTime::currentDateTime(); setFocusPolicy ( WheelFocus ); mViewerCallerIsSearchDialog = false; mBlockShowDates = false; @@ -642,6 +642,7 @@ void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString ¬i ) void CalendarView::addAlarm(const QDateTime &qdt, const QString ¬i ) { + mNextAlarmDateTime = qdt; //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { #ifndef DESKTOP_VERSION @@ -4064,3 +4065,18 @@ void CalendarView::resetFocus() } mViewerCallerIsSearchDialog = false; } + +void CalendarView::showNextAlarms() +{ + QString message; + if ( mNextAlarmDateTime > QDateTime::currentDateTime() ) { + QString sum = mCalendar->nextSummary(); + QDateTime nextA = mNextAlarmDateTime; + QDateTime nextAl = mCalendar->nextAlarmEventDateTime(); + message = i18n("The next alarm is on:\n%1\nat: %2\n\n%3\n(%4)").arg( KGlobal::locale()->formatDate(nextA.date() , false)).arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDateTime(nextAl , false)) ; + } else { + message = i18n("There is no next alarm."); + + } + KMessageBox::information( this, message); +} diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index 16e671f..9782ffe 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h @@ -176,6 +176,7 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser public slots: + void showNextAlarms(); void showOpenError(); void watchSavedFile(); void recheckTimerAlarm(); @@ -499,6 +500,7 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser Todo *selectedTodo(); private: + QDateTime mNextAlarmDateTime; bool mViewerCallerIsSearchDialog; bool mBlockShowDates; KSyncManager* mSyncManager; diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 95b836c..7a4275b 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp @@ -590,7 +590,7 @@ void MainWindow::initActions() mWeekFont.setPointSize( fontPoint ); QFontMetrics f( mWeekFont ); fontWid = f.width( "30" ); - qDebug("dec-- "); + //qDebug("dec-- "); } connect( mWeekAction, SIGNAL( activated() ), @@ -1748,7 +1748,10 @@ void MainWindow::keyPressEvent ( QKeyEvent * e ) mView->toggleExpand(); break; case Qt::Key_A: - mView->toggleAllDaySize(); + if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) + mView->showNextAlarms(); + else + mView->toggleAllDaySize(); break; case Qt::Key_T: if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) @@ -2133,3 +2136,15 @@ void MainWindow::weekAction() } delete popup; } + +void MainWindow::hideEvent ( QHideEvent * ) +{ + QString message; + QDateTime nextA = mCalendar->nextAlarmEventDateTime(); + if ( nextA.isValid() ) { + QString sum = mCalendar->nextSummary(); + + message = i18n("%1 %2 - %3 (next event/todo with alarm)").arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDate(nextA.date() , false)); + setCaption( message ); + } +} diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h index 7604529..b3041dc 100644 --- a/korganizer/mainwindow.h +++ b/korganizer/mainwindow.h @@ -104,6 +104,7 @@ class MainWindow : public QMainWindow void syncFileRequest(); protected: + void hideEvent ( QHideEvent * ); QString sentSyncFile(); void displayText( QString, QString); void enableIncidenceActions( bool ); -- cgit v0.9.0.2