diff options
Diffstat (limited to 'kteatime')
-rw-r--r-- | kteatime/CMakeL10n.txt | 12 | ||||
-rw-r--r-- | kteatime/CMakeLists.txt | 9 | ||||
-rw-r--r-- | kteatime/TODO | 2 | ||||
-rw-r--r-- | kteatime/eventsrc | 174 | ||||
-rw-r--r-- | kteatime/kteatime.desktop | 61 | ||||
-rw-r--r-- | kteatime/main.cpp | 1 | ||||
-rw-r--r-- | kteatime/timeedit.cpp | 16 | ||||
-rw-r--r-- | kteatime/timeedit.h | 4 | ||||
-rw-r--r-- | kteatime/toplevel.cpp | 177 | ||||
-rw-r--r-- | kteatime/toplevel.h | 32 |
10 files changed, 153 insertions, 335 deletions
diff --git a/kteatime/CMakeL10n.txt b/kteatime/CMakeL10n.txt index 1ad7fd7..48664ba 100644 --- a/kteatime/CMakeL10n.txt +++ b/kteatime/CMakeL10n.txt @@ -1,3 +1,15 @@ ##### create translation templates ############## tde_l10n_create_template( "kteatime" ) + +tde_l10n_create_template( + CATALOG "desktop_files/kteatime.desktop/" + SOURCES kteatime.desktop + DESTINATION "${CMAKE_SOURCE_DIR}/translations" +) + +tde_l10n_create_template( + CATALOG "desktop_files/kteatime-eventsrc/" + SOURCES_DESKTOP eventsrc + DESTINATION "${CMAKE_SOURCE_DIR}/translations" +) diff --git a/kteatime/CMakeLists.txt b/kteatime/CMakeLists.txt index a512391..0982ae4 100644 --- a/kteatime/CMakeLists.txt +++ b/kteatime/CMakeLists.txt @@ -41,11 +41,10 @@ tde_install_icons( ##### other data ################################ -install( FILES eventsrc +tde_create_translated_desktop( + SOURCE eventsrc DESTINATION ${DATA_INSTALL_DIR}/kteatime + PO_DIR kteatime-eventsrc ) -install( FILES kteatime.desktop - DESTINATION ${XDG_APPS_INSTALL_DIR} -) - +tde_create_translated_desktop( kteatime.desktop ) diff --git a/kteatime/TODO b/kteatime/TODO index b1b096d..4aa36a3 100644 --- a/kteatime/TODO +++ b/kteatime/TODO @@ -24,7 +24,7 @@ internals: - 'int2time()' somewhere into class-namespace? (ie. not as global function) -- do kapp->closeAllWindows() on slotFileQuit() ? +- do tdeApp->closeAllWindows() on slotFileQuit() ? - when in "ready"-state, left-click -> auto-go to initial state before opening left-click menu(?) - remember geometry of config-dialog (and its QListView!) diff --git a/kteatime/eventsrc b/kteatime/eventsrc index 5fff47c..fa3d1c5 100644 --- a/kteatime/eventsrc +++ b/kteatime/eventsrc @@ -1,183 +1,9 @@ [!Global!] IconName=kteatime Comment=The Tea Cooker -Comment[ar]=طابخ شاي -Comment[be]=Прыгатаўленне гарбаты пры дапамозе -Comment[bg]=Програма за приготвяне на чай -Comment[bn]=কে.ডি.ই.'র চায়ের কেটলি -Comment[br]=Pod te -Comment[bs]=kuhač čaja -Comment[ca]=El cuiner de te de -Comment[cs]=Vařič čaje pro -Comment[cy]=Tegell Te -Comment[da]=tekoger -Comment[de]=Der-Teekocher -Comment[el]=Εργαλείο φτιαξίματος τσαγιού του -Comment[eo]=La-Teinfuzilo -Comment[es]=Tetera de Kde -Comment[et]=teekann -Comment[eu]=Te-Sukaldea -Comment[fa]=چایساز -Comment[fi]=Teenkeittäjä -Comment[fr]=Le préparateur de thé de -Comment[ga]=Cócaire Tae -Comment[gl]=Quece chás -Comment[he]=מבשל התה של -Comment[hi]=केडीई चाय केतली -Comment[hr]=čajnik -Comment[hu]=teafőző -Comment[is]=te hitarinn -Comment[it]=La teiera di -Comment[ja]=ティーメーカー -Comment[km]=ចង្ក្រានតែ -Comment[ko]=차 끓이기 도구 -Comment[lv]=tējas vārītājs -Comment[mk]=Чајникот на -Comment[ms]=Penjerang Teh -Comment[mt]=Il-Kitla tat-Tè tal -Comment[nb]=tekoker -Comment[nds]=De-Teekaker -Comment[ne]=केडीई चिया बनाउने -Comment[nl]=De Theezetter -Comment[nn]=tekokaren -Comment[pl]=Przyrządzanie herbaty dla -Comment[pt]=Cozinheiro de chá do -Comment[pt_BR]=O cozinheiro do -Comment[ro]=Ceainicul -Comment[ru]=Приготовление чая -Comment[sk]=Varič čaju pre -Comment[sl]=Kuhalnik čaja za -Comment[sr]=Чајник -Comment[sr@Latn]=Čajnik -Comment[sv]=tekokare -Comment[ta]=The தேநீர் குக்கர் -Comment[tg]=Пухтани Чойи -Comment[tr]=Çay Pişirici -Comment[uk]=Приготування чаю -Comment[uz]=choy damlovchi -Comment[uz@cyrillic]=чой дамловчи -Comment[wa]=Li fjheu di té di -Comment[zh_CN]=煮茶器 -Comment[zh_TW]=煮茶器 [tea] Name=Tea is ready -Name[ar]=الشاي جاهز -Name[be]=Гарбата гатова -Name[bg]=Чаят е готов -Name[bn]=চা প্রস্তুত -Name[br]=Prest eo an te -Name[bs]=Čaj je gotov -Name[ca]=El te està fet -Name[cs]=Čaj je připraven -Name[cy]=Mae'r te yn barod -Name[da]=Teen er klar -Name[de]=Tee ist fertig -Name[el]=Το τσάι είναι έτοιμο -Name[eo]=Teo estas preta -Name[es]=El té está listo -Name[et]=Tee on valmis -Name[eu]=Tea prest dago -Name[fa]=چای آماده است -Name[fi]=Tee on valmista -Name[fr]=Le thé est prêt -Name[ga]=Tá an tae réidh -Name[gl]=O chá está feito -Name[he]= התה מוכן -Name[hi]=चाय तैयार है -Name[hr]=Čaj je spreman -Name[hu]=Kész a tea! -Name[is]=Te hitarinn -Name[it]=Il tè è pronto -Name[ja]=お茶が入りました -Name[km]=តែឆ្អិនហើយ -Name[ko]=차가 준비되었습니다 -Name[lv]=Tēja ir gatava -Name[mk]=Чајот е готов -Name[mt]=It-Tè lest -Name[nb]=Tekokeren -Name[nds]=Tee is fardig -Name[ne]=चिया तयार छ -Name[nl]=De thee is klaar -Name[nn]=Teen er klar -Name[pl]=Herbata jest gotowa -Name[pt]=o chá está pronto -Name[pt_BR]=O chá está pronto -Name[ro]=Gata ceaiul -Name[ru]=Чай готов -Name[sk]=Čaj je pripravený -Name[sl]=Čaj je pripravljen -Name[sr]=Чај је готов -Name[sr@Latn]=Čaj je gotov -Name[sv]=Teet är klart -Name[ta]= தேநீர் தயார் -Name[tg]=Чой тайёр шуд -Name[tr]=Çay hazır -Name[uk]=Чай готовий -Name[uz]=Choy tayyor -Name[uz@cyrillic]=Чой тайёр -Name[wa]=Li té est presse -Name[zh_CN]=茶沏好了 -Name[zh_TW]=茶煮好了 Comment=Tea is ready -Comment[ar]=الشاي جاهز -Comment[be]=Гарбата гатова -Comment[bg]=Чаят е готов -Comment[bn]=অই চা গরমমম!!! -Comment[br]=Prest eo an te -Comment[bs]=Čaj je gotov -Comment[ca]=El te està fet -Comment[cs]=Čaj je připraven -Comment[cy]=Mae'r te yn barod -Comment[da]=Teen er klar -Comment[de]=Tee ist fertig -Comment[el]=Το τσάι είναι έτοιμο -Comment[eo]=Teo estas preta -Comment[es]=El té está listo -Comment[et]=Tee on valmis -Comment[eu]=Tea prest dago -Comment[fa]=چای آماده است -Comment[fi]=Tee on valmista -Comment[fr]=Le thé est prêt -Comment[ga]=Tá an tae réidh -Comment[gl]=O té está feito -Comment[he]=התה מוכן -Comment[hi]=चाय तैयार है -Comment[hr]=Čaj je spreman -Comment[hu]=Kész a tea! -Comment[is]=Teið er tilbúið -Comment[it]=Il tè è pronto -Comment[ja]=お茶が入りました -Comment[km]=តែឆ្អិនហើយ -Comment[ko]=차가 준비되었습니다 -Comment[lv]=Tēja ir gatava -Comment[mk]=Чајот е готов -Comment[ms]=Teh sudah siap -Comment[mt]=It-Tè lest -Comment[nb]=Teen er klar -Comment[nds]=Tee is fardig -Comment[ne]=चिया तयार छ -Comment[nl]=De thee is klaar -Comment[nn]=Teen er klar -Comment[pl]=Herbata jest gotowa -Comment[pt]=O chá está pronto -Comment[pt_BR]=O chá está pronto -Comment[ro]=Ceaiul este gata -Comment[ru]=Чай готов -Comment[sk]=Čaj je pripravený -Comment[sl]=Čaj je pripravljen -Comment[sr]=Чај је готов -Comment[sr@Latn]=Čaj je gotov -Comment[sv]=Teet är klart -Comment[ta]= தேநீர் தயார் -Comment[tg]=Чой тайёр шуд -Comment[tr]=Çay hazır -Comment[uk]=Чай готовий -Comment[uz]=Choy tayyor -Comment[uz@cyrillic]=Чой тайёр -Comment[wa]=Li té est presse -Comment[zh_CN]=茶沏好了 -Comment[zh_TW]=茶煮好了 default_sound=KDE_Notify.wav default_presentation=1 - diff --git a/kteatime/kteatime.desktop b/kteatime/kteatime.desktop index 3763213..b90be96 100644 --- a/kteatime/kteatime.desktop +++ b/kteatime/kteatime.desktop @@ -1,67 +1,6 @@ [Desktop Entry] Name=KTeaTime -Name[ar]=برنامج تحضير الشاي KTeaTime -Name[bn]=কে-টী-টাইম -Name[hr]=KVrijeme za čaj -Name[mk]=КЧајник -Name[mt]=It-Tè lest -Name[ne]=केडीई चिया समय -Name[sv]=Teet är klart -Name[ta]= கேதேநீர் நேரம் -Name[tg]=КВақтиЧой GenericName=Tea Cooker -GenericName[be]=Прыгатаўленне гарбаты -GenericName[bg]=Приготвяне на чай -GenericName[bn]=চায়ের কেটলি -GenericName[br]=Ar pod te -GenericName[ca]=El cuiner de te -GenericName[cs]=Vařič čaje -GenericName[cy]=Tegell Te -GenericName[da]=Tekoger -GenericName[de]=Teekocher -GenericName[el]=Εργαλείο φτιαξίματος τσαγιού -GenericName[eo]=Teinfuzilo -GenericName[es]=Tetera -GenericName[et]=Teekann -GenericName[eu]=Te-Sukaldea -GenericName[fa]=چایساز -GenericName[fi]=Teenkeittäjä -GenericName[fr]=Préparateur de thé -GenericName[ga]=Cócaire Tae -GenericName[gl]=Quece Chá -GenericName[he]=מבשל התה -GenericName[hr]=Čajnik -GenericName[hu]=Teafőző -GenericName[is]=Te hitarinn -GenericName[it]=Teiera -GenericName[ja]=ティーメーカー -GenericName[km]=ចង្ក្រានតែ -GenericName[ko]=차 끓이기 -GenericName[lv]=Tējas vārītājs -GenericName[mk]=Чајник -GenericName[mt]=Il-Kitla tat-Tè -GenericName[nb]=Tekoker -GenericName[nds]=Teekaker -GenericName[ne]=चिया बनाउने -GenericName[nl]=Theezetter -GenericName[nn]=Tekokaren -GenericName[pl]=Przyrządzanie herbaty -GenericName[pt]=Chá -GenericName[pt_BR]=Hora do Chá -GenericName[ro]=Ceainic -GenericName[ru]=Приготовление чая -GenericName[sk]=Varič čaju -GenericName[sl]=Kuhalnik čaja -GenericName[sr]=Чајник -GenericName[sr@Latn]=Čajnik -GenericName[sv]=Tekokaren -GenericName[ta]= தேநீர் தயாரிப்பான் -GenericName[tg]=ЧойДамКардан -GenericName[tr]=Çaycı -GenericName[uk]=Приготування чаю -GenericName[wa]=Fijheu d' té -GenericName[zh_CN]=煮茶器 -GenericName[zh_TW]=煮茶器 Exec=kteatime Icon=kteatime Type=Application diff --git a/kteatime/main.cpp b/kteatime/main.cpp index 6962e4c..be661b3 100644 --- a/kteatime/main.cpp +++ b/kteatime/main.cpp @@ -25,6 +25,7 @@ */ #include <twin.h> +#include <tdeapplication.h> #include <tdestartupinfo.h> #include <tdecmdlineargs.h> #include <tdeaboutdata.h> diff --git a/kteatime/timeedit.cpp b/kteatime/timeedit.cpp index 221029d..032b12e 100644 --- a/kteatime/timeedit.cpp +++ b/kteatime/timeedit.cpp @@ -71,10 +71,10 @@ TimeEdit::TimeEdit(TQWidget* parent, const char* name) layout->addWidget(secondBox); layout->addWidget(sec); - connect(minuteBox, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(spinBoxValueChanged(int)) ); - connect(secondBox, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(spinBoxValueChanged(int)) ); - connect(secondBox, TQT_SIGNAL(wrapUp()), TQT_SLOT(wrappedUp())); - connect(secondBox, TQT_SIGNAL(wrapDown()), TQT_SLOT(wrappedDown())); + connect(minuteBox, TQ_SIGNAL(valueChanged(int)), TQ_SLOT(spinBoxValueChanged(int)) ); + connect(secondBox, TQ_SIGNAL(valueChanged(int)), TQ_SLOT(spinBoxValueChanged(int)) ); + connect(secondBox, TQ_SIGNAL(wrapUp()), TQ_SLOT(wrappedUp())); + connect(secondBox, TQ_SIGNAL(wrapDown()), TQ_SLOT(wrappedDown())); } TimeEdit::~TimeEdit() @@ -107,7 +107,7 @@ int TimeEdit::value() return minuteBox->value()*60 + secondBox->value(); } -/** SLOT: Handle wrap-up of seconds-box */ +/** Slot: Handle wrap-up of seconds-box */ void TimeEdit::wrappedUp() { if (minuteBox->value() != minuteBox->maxValue()) { @@ -117,7 +117,7 @@ void TimeEdit::wrappedUp() } } -/** SLOT: Handle wrap-down of seconds-box */ +/** Slot: Handle wrap-down of seconds-box */ void TimeEdit::wrappedDown() { // well, the "if" should always be true @@ -128,7 +128,7 @@ void TimeEdit::wrappedDown() } } -/** SLOT: Handle any change in minutes of seconds */ +/** Slot: Handle any change in minutes of seconds */ void TimeEdit::spinBoxValueChanged(int) { if (value() == 0) { @@ -139,7 +139,7 @@ void TimeEdit::spinBoxValueChanged(int) emit valueChanged(value()); } -/** TQT_SLOT (overloading TQSpinBox): set focus */ +/** Slot (overloading TQSpinBox): set focus */ void TimeEdit::setFocus() { minuteBox->setFocus(); diff --git a/kteatime/timeedit.h b/kteatime/timeedit.h index 8b317b8..6fe4b95 100644 --- a/kteatime/timeedit.h +++ b/kteatime/timeedit.h @@ -20,7 +20,7 @@ class TQBoxLayout; */ class WrappingSpinBox : public TQSpinBox { - Q_OBJECT + TQ_OBJECT public: @@ -42,7 +42,7 @@ signals: */ class TimeEdit : public TQWidget { - Q_OBJECT + TQ_OBJECT public: diff --git a/kteatime/toplevel.cpp b/kteatime/toplevel.cpp index 2d0ee03..325fe13 100644 --- a/kteatime/toplevel.cpp +++ b/kteatime/toplevel.cpp @@ -28,16 +28,16 @@ #include <tqhbox.h> #include <tqvbox.h> #include <tqlineedit.h> +#include <tqlistview.h> #include <tqpainter.h> #include <tqtooltip.h> #include <tqfile.h> #include <tqcursor.h> #include <tqpushbutton.h> #include <tqgroupbox.h> -#include <tqheader.h> -#include <tqpixmap.h> #include <tqbitmap.h> +#include <tdeapplication.h> #include <tdeconfig.h> #include <khelpmenu.h> #include <kiconloader.h> @@ -45,17 +45,14 @@ #include <tdemessagebox.h> #include <kpassivepopup.h> #include <knotifyclient.h> -#include <knuminput.h> -#include <kseparator.h> +#include <knotifydialog.h> #include <tdepopupmenu.h> #include <kdialogbase.h> #include <tdeaction.h> -#include <knotifydialog.h> #include "tealist.h" #include "timeedit.h" #include "toplevel.h" -#include "toplevel.moc" const int TopLevel::DEFAULT_TEA_TIME = 3*60; @@ -69,7 +66,7 @@ TopLevel::TopLevel() : KSystemTray() teas.clear(); - TDEConfig *config = kapp->config(); + TDEConfig *config = tdeApp->config(); config->setGroup("Teas"); if (config->hasKey("Number")) { @@ -115,27 +112,27 @@ TopLevel::TopLevel() : KSystemTray() current_selected = 0; listempty = (teas.count() == 0); - + popupBox = nullptr; startAct = new TDEAction(i18n("&Start"), "1rightarrow", 0, - TQT_TQOBJECT(this), TQT_SLOT(start()), actionCollection(), "start"); + this, TQ_SLOT(start()), actionCollection(), "start"); stopAct = new TDEAction(i18n("Sto&p"), "cancel", 0, - TQT_TQOBJECT(this), TQT_SLOT(stop()), actionCollection(), "stop"); + this, TQ_SLOT(stop()), actionCollection(), "stop"); confAct = new TDEAction(i18n("&Configure..."), "configure", 0, - TQT_TQOBJECT(this), TQT_SLOT(config()), actionCollection(), "configure"); + this, TQ_SLOT(config()), actionCollection(), "configure"); anonAct = new TDEAction(i18n("&Anonymous..."), 0, 0, - TQT_TQOBJECT(this), TQT_SLOT(anonymous()), actionCollection(), "anonymous"); + this, TQ_SLOT(anonymous()), actionCollection(), "anonymous"); // TDEAction *quitAct = actionCollection()->action("file_quit"); // create app menu (displayed on right-click) menu = new TQPopupMenu(); menu->setCheckable(true); - connect(menu, TQT_SIGNAL(activated(int)), this, TQT_SLOT(teaSelected(int))); + connect(menu, TQ_SIGNAL(activated(int)), this, TQ_SLOT(teaSelected(int))); // this menu will be displayed when no tea is steeping, and left mouse button is clicked start_menu = new TQPopupMenu(); start_menu->setCheckable(true); // menu isn't tickable, but this gives some add. spacing - connect(start_menu, TQT_SIGNAL(activated(int)), this, TQT_SLOT(teaStartSelected(int))); + connect(start_menu, TQ_SIGNAL(activated(int)), this, TQ_SLOT(teaStartSelected(int))); rebuildTeaMenus(); // populate tops of menus with tea-entries from config @@ -152,13 +149,13 @@ TopLevel::TopLevel() : KSystemTray() menu->insertSeparator(); confAct->plug(menu); menu->insertItem(SmallIcon("help"), i18n("&Help"), helpMnu); - menu->insertItem(SmallIcon("system-log-out"), i18n("Quit"), kapp, TQT_SLOT(quit())); + menu->insertItem(SmallIcon("system-log-out"), i18n("Quit"), tdeApp, TQ_SLOT(quit())); // quitAct->plug(menu); // FIXME: this doesn't seem to work with above definition of quitAct? // (need special 'quit'-method?) // this menu will be displayed when a tea is steeping, and left mouse button is clicked steeping_menu = new TQPopupMenu(); -// steeping_menu->insertItem(SmallIcon("cancel"), i18n("Just &Cancel Current"), this, TQT_SLOT(stop())); +// steeping_menu->insertItem(SmallIcon("cancel"), i18n("Just &Cancel Current"), this, TQ_SLOT(stop())); stopAct->plug(steeping_menu); // FIXME: can provide different text for this incarnation? // start_menu->insertSeparator(); @@ -167,6 +164,7 @@ TopLevel::TopLevel() : KSystemTray() // read remaining entries from config-file useNotify = config->readBoolEntry("Beep", true); // "Beep" should really be named "Notify" usePopup = config->readBoolEntry("Popup", true); + useResetOnPopup = config->readBoolEntry("ResetOnPopupClick", false); useAction = config->readBoolEntry("UseAction", true); action = config->readEntry("Action"); useTrayVis = config->readBoolEntry("UseTrayVis", true); @@ -182,16 +180,6 @@ TopLevel::TopLevel() : KSystemTray() stop(); // reset timer, disable some menu entries, etc. } -/* slot: signal shutDown() from TDEApplication */ -/* (not currently needed) -void TopLevel::queryExit() -{ - TDEConfig *config = kapp->config(); -// config->sync(); -} -*/ - - /** Destructor */ TopLevel::~TopLevel() { @@ -225,7 +213,7 @@ void TopLevel::showEvent ( TQShowEvent * ) /** Handle mousePressEvent */ void TopLevel::mousePressEvent(TQMouseEvent *event) { - if (event->button() == Qt::LeftButton) { + if (event->button() == TQt::LeftButton) { if (ready) { stop(); // reset tooltip and stop animation } else { @@ -234,7 +222,7 @@ void TopLevel::mousePressEvent(TQMouseEvent *event) else start_menu->popup(TQCursor::pos()); } - } else if (event->button() == Qt::RightButton) + } else if (event->button() == TQt::RightButton) menu->popup(TQCursor::pos()); // else if (event->button() == MidButton) // currently unused } @@ -325,9 +313,11 @@ void TopLevel::timerEvent(TQTimerEvent *) system(TQFile::encodeName(cmd)); } if (usePopup) - KPassivePopup::message(i18n("The Tea Cooker"), - teaMessage, teaAnim1Pixmap, this, "popup", 0); - // FIXME: does auto-deletion work without timeout? + { + popupBox = KPassivePopup::message(i18n("The Tea Cooker"), + teaMessage, teaAnim1Pixmap, this, "popup", 0); + connect(popupBox, TQ_SIGNAL(clicked()), this, TQ_SLOT(popupClicked())); + } setToolTip(teaMessage); repaint(); } else { @@ -421,7 +411,7 @@ void TopLevel::teaSelected(int index) menu->setItemChecked(index, true); current_selected = index; - TDEConfig *config = kapp->config(); + TDEConfig *config = tdeApp->config(); config->setGroup("General"); config->writeEntry("Tea", current_selected); } @@ -452,11 +442,12 @@ void TopLevel::start() } // else both are already defined by dialog handler - TQT_TQOBJECT(this)->killTimers(); + this->killTimers(); startTimer(1000); // 1000ms = 1s (sufficient resolution) running = true; ready = false; + firstFrame = true; enable_menuEntries(); // disable "start", enable "stop" repaint(); @@ -466,7 +457,7 @@ void TopLevel::start() /* menu-slot: "stop" selected in menu */ void TopLevel::stop() { - TQT_TQOBJECT(this)->killTimers(); + this->killTimers(); running = false; ready = false; @@ -480,6 +471,23 @@ void TopLevel::stop() setToolTip(i18n("The Tea Cooker"), true); repaint(); + + // Close popup if still open. The popupBox autodeletes when + // hidden, so no need to manually delete it + if (popupBox) + { + popupBox->hide(); + popupBox = nullptr; + } +} + +void TopLevel::popupClicked() +{ + popupBox = nullptr; + if (usePopup && useResetOnPopup) + { + stop(); // reset tooltip and stop animation + } } /* open dialog to start an 'anonymous' tea */ @@ -648,6 +656,16 @@ void TopLevel::downButtonClicked() { enable_controls(); } +void TopLevel::eventEnableToggled(bool on) +{ + btn_conf->setEnabled(on); +} + +void TopLevel::popupEnableToggled(bool on) +{ + resetOnPopupEnable->setEnabled(on); +} + /* config-slot: checkbox next to "action" field toggled*/ void TopLevel::actionEnableToggled(bool on) { @@ -657,7 +675,7 @@ void TopLevel::actionEnableToggled(bool on) /* config-slot: "help" button clicked */ void TopLevel::help() { - kapp->invokeHelp(); + tdeApp->invokeHelp(); } /* config-slot: "Configure Events..." button clicked */ @@ -682,7 +700,7 @@ void TopLevel::config() /* left side - tea list and list-modifying buttons */ TQBoxLayout *leftside = new TQVBoxLayout(box); - TQGroupBox *listgroup = new TQGroupBox(2,Qt::Vertical, i18n("Tea List"), page); + TQGroupBox *listgroup = new TQGroupBox(2,TQt::Vertical, i18n("Tea List"), page); leftside->addWidget(listgroup, 0, 0); listbox = new TQListView(listgroup, "listBox"); @@ -691,7 +709,7 @@ void TopLevel::config() listbox->addColumn(i18n("Time")); listbox->header()->setClickEnabled(false, listbox->header()->count()-1); listbox->setSorting(-1); - connect(listbox, TQT_SIGNAL(selectionChanged()), TQT_SLOT(listBoxItemSelected())); + connect(listbox, TQ_SIGNAL(selectionChanged()), TQ_SLOT(listBoxItemSelected())); // now buttons for editing the tea-list TQWidget *listgroup_widget = new TQWidget(listgroup); @@ -701,36 +719,38 @@ void TopLevel::config() TQToolTip::add(btn_new, i18n("New")); btn_new->setPixmap(SmallIcon("document-new")); btn_new->setMinimumSize(btn_new->sizeHint() * 1.2); - connect(btn_new, TQT_SIGNAL(clicked()), TQT_SLOT(newButtonClicked())); + connect(btn_new, TQ_SIGNAL(clicked()), TQ_SLOT(newButtonClicked())); hbox->addWidget(btn_new); btn_del = new TQPushButton(TQString(), listgroup_widget); TQToolTip::add(btn_del, i18n("Delete")); btn_del->setIconSet(SmallIconSet("edit-delete")); btn_del->setMinimumSize(btn_new->sizeHint() * 1.2); - connect(btn_del, TQT_SIGNAL(clicked()), TQT_SLOT(delButtonClicked())); + connect(btn_del, TQ_SIGNAL(clicked()), TQ_SLOT(delButtonClicked())); hbox->addWidget(btn_del); btn_up = new TQPushButton(TQString(), listgroup_widget); TQToolTip::add(btn_up, i18n("Up")); btn_up->setIconSet(SmallIconSet("go-up")); btn_up->setMinimumSize(btn_up->sizeHint() * 1.2); - connect(btn_up, TQT_SIGNAL(clicked()), TQT_SLOT(upButtonClicked())); + connect(btn_up, TQ_SIGNAL(clicked()), TQ_SLOT(upButtonClicked())); hbox->addWidget(btn_up); btn_down = new TQPushButton(TQString(), listgroup_widget); TQToolTip::add(btn_down, i18n("Down")); btn_down->setIconSet(SmallIconSet("go-down")); btn_down->setMinimumSize(btn_down->sizeHint() * 1.2); - connect(btn_down, TQT_SIGNAL(clicked()), TQT_SLOT(downButtonClicked())); + connect(btn_down, TQ_SIGNAL(clicked()), TQ_SLOT(downButtonClicked())); hbox->addWidget(btn_down); hbox->addStretch(10); /* right side - tea properties */ TQBoxLayout *rightside = new TQVBoxLayout(box); - editgroup = new TQGroupBox(2,Qt::Vertical, i18n("Tea Properties"), page); + editgroup = new TQGroupBox(2,TQt::Vertical, i18n("Tea Properties"), page); rightside->addWidget(editgroup, 0, 0); + rightside->addStretch(); + TQHBox *propbox = new TQHBox(editgroup); // FIXME: - must enforce correct vertical alignment of each label-editor pair @@ -742,49 +762,59 @@ void TopLevel::config() nameEdit->setAlignment(TQLineEdit::AlignLeft); TQLabel *l = new TQLabel(nameEdit, i18n("Name:"), propleft); l->setFixedSize(l->sizeHint()); - connect(nameEdit, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(nameEditTextChanged(const TQString&)) ); + connect(nameEdit, TQ_SIGNAL(textChanged(const TQString&)), TQ_SLOT(nameEditTextChanged(const TQString&)) ); timeEdit = new TimeEdit(propright); timeEdit->setFixedHeight(timeEdit->sizeHint().height()); l = new TQLabel(timeEdit, i18n("Tea time:"), propleft); l->setFixedSize(l->sizeHint()); - connect(timeEdit, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(spinBoxValueChanged(int))); + connect(timeEdit, TQ_SIGNAL(valueChanged(int)), TQ_SLOT(spinBoxValueChanged(int))); /* bottom - timeout actions */ - TQGroupBox *actiongroup = new TQGroupBox(4,Qt::Vertical, i18n("Action"), page); - top_box->addWidget(actiongroup, 0, 0); - - TQWidget *actionconf_widget = new TQWidget(actiongroup); - TQBoxLayout *actionconf_hbox = new TQHBoxLayout(actionconf_widget); - btn_conf = new TQPushButton(i18n("Configure Events..."), actionconf_widget); - actionconf_hbox->addWidget(btn_conf); - connect(btn_conf, TQT_SIGNAL(clicked()), TQT_SLOT(confButtonClicked())); - actionconf_hbox->addStretch(10); - - eventEnable = new TQCheckBox(i18n("Event"), actiongroup); - popupEnable = new TQCheckBox(i18n("Popup"), actiongroup); - eventEnable->setFixedHeight(eventEnable->sizeHint().height()); - popupEnable->setFixedHeight(popupEnable->sizeHint().height()); - - TQHBox *actionbox = new TQHBox(actiongroup); - actionEnable = new TQCheckBox(actionbox); -// FIXME: add text to this line: -// TQLabel *actionLabel = new TQLabel(i18n("Execute: "), actiongroup); - actionEdit = new TQLineEdit(actionbox); + TQGridLayout *actionsGrid = new TQGridLayout(top_box, 5, 2, 5); + TQLabel *actionsLabel = new TQLabel(i18n("Actions"), page); + TQFont actionsLblFont = actionsLabel->font(); + actionsLblFont.setBold(true); + actionsLabel->setFont(actionsLblFont); + actionsGrid->addMultiCellWidget(actionsLabel, 0, 0, 0, 1); + + eventEnable = new TQCheckBox(i18n("Event"), page); + TQToolTip::add(eventEnable, i18n("Enable events when the tea is ready")); + connect(eventEnable, TQ_SIGNAL(toggled(bool)), TQ_SLOT(eventEnableToggled(bool))); + actionsGrid->addWidget(eventEnable, 1, 0); + + btn_conf = new TQPushButton(i18n("Configure Events..."), page); + btn_conf->setFixedSize(btn_conf->sizeHint()); + connect(btn_conf, TQ_SIGNAL(clicked()), TQ_SLOT(confButtonClicked())); + actionsGrid->addWidget(btn_conf, 1, 1); + + popupEnable = new TQCheckBox(i18n("Popup"), page); + TQToolTip::add(popupEnable, i18n("Show a popup notification when the tea is ready")); + connect(popupEnable, TQ_SIGNAL(toggled(bool)), TQ_SLOT(popupEnableToggled(bool))); + actionsGrid->addWidget(popupEnable, 2, 0); + + resetOnPopupEnable = new TQCheckBox(i18n("Reset on popup click"), page); + TQToolTip::add(resetOnPopupEnable, i18n("Reset tea when the popup notification is clicked")); + actionsGrid->addWidget(resetOnPopupEnable, 2, 1); + + actionEnable = new TQCheckBox(i18n("Command"), page); + TQToolTip::add(actionEnable, i18n("Run a command when the tea is ready")); + connect(actionEnable, TQ_SIGNAL(toggled(bool)), TQ_SLOT(actionEnableToggled(bool))); + actionsGrid->addWidget(actionEnable, 3, 0); + + actionEdit = new TQLineEdit(page); actionEdit->setFixedHeight(actionEdit->sizeHint().height()); TQToolTip::add(actionEdit, i18n("Enter command here; '%t' will be replaced with name of steeping tea")); - connect(actionEnable, TQT_SIGNAL(toggled(bool)), TQT_SLOT(actionEnableToggled(bool))); - rightside->addStretch(); + actionsGrid->addWidget(actionEdit, 3, 1); // single checkbox visEnable = new TQCheckBox(i18n("Visualize progress in icon tray"), page); - top_box->addWidget(visEnable, 0, 0); - + actionsGrid->addMultiCellWidget(visEnable, 4, 4, 0, 1); // let listbox claim all remaining vertical space top_box->setStretchFactor(box, 10); - connect(confdlg, TQT_SIGNAL(helpClicked()), TQT_SLOT(help())); + connect(confdlg, TQ_SIGNAL(helpClicked()), TQ_SLOT(help())); } // now add all defined teas (and their times) to the listview @@ -811,7 +841,10 @@ void TopLevel::config() // ------------------------- eventEnable->setChecked(useNotify); + btn_conf->setEnabled(useNotify); popupEnable->setChecked(usePopup); + resetOnPopupEnable->setChecked(useResetOnPopup); + resetOnPopupEnable->setEnabled(usePopup); actionEnable->setChecked(useAction); actionEdit->setText(action); actionEdit->setEnabled(useAction); @@ -822,6 +855,7 @@ void TopLevel::config() // activate new settings useNotify = eventEnable->isChecked(); usePopup = popupEnable->isChecked(); + useResetOnPopup = resetOnPopupEnable->isChecked(); useAction = actionEnable->isChecked(); action = actionEdit->text(); useTrayVis = visEnable->isChecked(); @@ -845,7 +879,7 @@ void TopLevel::config() rebuildTeaMenus(); // and store to config - TDEConfig *config = kapp->config(); + TDEConfig *config = tdeApp->config(); // remove old-style entries from default-group (if present) if (config->hasKey("UserTea")) config->deleteEntry("UserTea"); @@ -853,6 +887,7 @@ void TopLevel::config() config->setGroup("General"); config->writeEntry("Beep", useNotify); config->writeEntry("Popup", usePopup); + config->writeEntry("ResetOnPopupClick", useResetOnPopup); config->writeEntry("UseAction", useAction); config->writeEntry("Action", action); config->writeEntry("Tea", current_selected); @@ -874,3 +909,5 @@ void TopLevel::config() config->sync(); } } + +#include "toplevel.moc" diff --git a/kteatime/toplevel.h b/kteatime/toplevel.h index 02d8c20..fafbe7c 100644 --- a/kteatime/toplevel.h +++ b/kteatime/toplevel.h @@ -23,27 +23,27 @@ #ifndef TOPLEVEL_H #define TOPLEVEL_H -#include <tdeapplication.h> -#include <tqpopupmenu.h> -#include <tqtimer.h> -#include <tqlineedit.h> #include <tqvaluevector.h> -#include <tqlistview.h> -#include <tqpushbutton.h> -#include <tqgroupbox.h> -#include <knuminput.h> #include <ksystemtray.h> #include <tqpixmap.h> -class TDEAction; -class KDialogBase; class TQCheckBox; +class TQGroupBox; +class TQLineEdit; +class TQListView; +class TQListViewItem; +class TQPopupMenu; +class TQPushButton; + +class KDialogBase; +class KPassivePopup; +class TDEAction; + class TimeEdit; class TopLevel : public KSystemTray { - Q_OBJECT - + TQ_OBJECT public: @@ -64,6 +64,7 @@ private slots: void teaStartSelected(int index); void start(); void stop(); + void popupClicked(); void config(); void help(); void anonymous(); @@ -82,6 +83,8 @@ private slots: void disable_properties(); void enable_properties(); void enable_controls(); + void eventEnableToggled(bool on); + void popupEnableToggled(bool on); void actionEnableToggled(bool on); private: @@ -107,7 +110,7 @@ private: TQString current_name; // name of currently +running+ tea (if any) bool shooting; // anonymous tea currently steeping? - bool useNotify, usePopup, useAction; + bool useNotify, usePopup, useResetOnPopup, useAction; TQString action; bool useTrayVis; // visualize progress in tray icon @@ -120,11 +123,12 @@ private: TimeEdit *timeEdit; TQGroupBox *editgroup; TQPushButton *btn_new, *btn_del, *btn_up, *btn_down, *btn_conf; + KPassivePopup *popupBox; TQString lastTip; KDialogBase *anondlg, *confdlg; TimeEdit *anon_time; - TQCheckBox *eventEnable, *popupEnable, *actionEnable, *visEnable; + TQCheckBox *eventEnable, *popupEnable, *actionEnable, *visEnable, *resetOnPopupEnable; }; #endif |