From 59fee003137f5fd7782e3a42159e53424d100e67 Mon Sep 17 00:00:00 2001 From: harlekin Date: Sun, 04 Jan 2004 15:47:32 +0000 Subject: config taskbar applet --- (limited to 'noncore/net') diff --git a/noncore/net/mail/mail.pro b/noncore/net/mail/mail.pro index a96c88e..96ffaa8 100644 --- a/noncore/net/mail/mail.pro +++ b/noncore/net/mail/mail.pro @@ -36,7 +36,8 @@ INTERFACES = editaccountsui.ui \ composemailui.ui \ settingsdialogui.ui \ statuswidgetui.ui \ - newmaildirui.ui + newmaildirui.ui + INCLUDEPATH += $(OPIEDIR)/include diff --git a/noncore/net/mail/settingsdialog.cpp b/noncore/net/mail/settingsdialog.cpp index f9de405..061ea72 100644 --- a/noncore/net/mail/settingsdialog.cpp +++ b/noncore/net/mail/settingsdialog.cpp @@ -1,4 +1,5 @@ #include +#include #include @@ -21,6 +22,12 @@ void SettingsDialog::readConfig() { showHtmlButton->setChecked( cfg.readBoolEntry( "showHtml", false ) ); cfg.setGroup( "Compose" ); checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) ); + cfg.setGroup( "Applet" ); + cbEnableTaskbarApplet->setChecked( cfg.readBoolEntry( "Disabled", false ) ); + spCheckOften->setValue( cfg.readNumEntry( "CheckEvery", 5 ) ); + cbBlinkLed->setChecked( cfg.readBoolEntry( "BlinkLed", true ) ); + cbPlaySound->setChecked( cfg.readBoolEntry( "PlaySound", false ) ); + } void SettingsDialog::writeConfig() { @@ -28,8 +35,12 @@ void SettingsDialog::writeConfig() { cfg.setGroup( "Settings" ); cfg.writeEntry( "showHtml", showHtmlButton->isChecked() ); cfg.setGroup( "Compose" ); - cfg.writeEntry( "sendLater", checkBoxLater->isChecked() );; - + cfg.writeEntry( "sendLater", checkBoxLater->isChecked() ); + cfg.setGroup( "Applet" ); + cfg.writeEntry( "Disabled", cbEnableTaskbarApplet->isChecked() ); + cfg.writeEntry( "CheckEvery", spCheckOften->value() ); + cfg.writeEntry( "BlinkLed", cbBlinkLed->isChecked() ); + cfg.writeEntry( "PlaySound", cbPlaySound->isChecked() ); } void SettingsDialog::accept() { diff --git a/noncore/net/mail/settingsdialogui.ui b/noncore/net/mail/settingsdialogui.ui index c5589dc..a078168 100644 --- a/noncore/net/mail/settingsdialogui.ui +++ b/noncore/net/mail/settingsdialogui.ui @@ -11,7 +11,7 @@ 0 0 - 324 + 320 379 @@ -152,6 +152,124 @@ + + QWidget + + name + tab + + + title + Taskbar Applet + + + + margin + 3 + + + spacing + 3 + + + QCheckBox + + name + cbEnableTaskbarApplet + + + text + Enable Taskbar Applet + + + + QLayoutWidget + + name + Layout2 + + + + margin + 0 + + + spacing + 6 + + + QSpinBox + + name + spCheckOften + + + suffix + min + + + value + 5 + + + + QLabel + + name + TextLabel1 + + + text + Check how often + + + + + + QCheckBox + + name + cbBlinkLed + + + text + Blink Led when new mails arrive + + + + QCheckBox + + name + cbPlaySound + + + text + Play Sound when new mails arrive + + + + + name + Spacer3 + + + orientation + Vertical + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + + diff --git a/noncore/net/mail/taskbarapplet/mailapplet.cpp b/noncore/net/mail/taskbarapplet/mailapplet.cpp index f3550c7..8bf4b89 100644 --- a/noncore/net/mail/taskbarapplet/mailapplet.cpp +++ b/noncore/net/mail/taskbarapplet/mailapplet.cpp @@ -68,8 +68,36 @@ void MailApplet::slotCheck() { m_intervalMs = newIntervalMs; } + int newMails = 0; + + if ( true ) { + ODevice *device = ODevice::inst(); + if ( isHidden() ) show(); + if ( m_config->readBoolEntry( "BlinkLed", true ) ) { + if ( !device-> ledList ( ).isEmpty( ) ) { + OLed led = ( device->ledList( ).contains( Led_Mail ) ) ? Led_Mail : device->ledList( ) [0]; + device->setLedState( led, device->ledStateList( led ).contains( Led_BlinkSlow ) ? Led_BlinkSlow : Led_On ); + } + } + if ( m_config->readBoolEntry( "PlaySound", false ) ) + device->alarmSound(); + + Config cfg( "mail" ); + cfg.setGroup( "Status" ); + cfg.writeEntry( "NewMails", newMails ); // todo + + QCopEnvelope env( "QPE/Pim", "newMails(int)" ); + env << newMails; + + } else { + ODevice *device = ODevice::inst(); + if ( !isHidden() ) hide(); + if ( !device-> ledList( ).isEmpty( ) ) { + OLed led = ( device->ledList( ).contains( Led_Mail ) ) ? Led_Mail : device->ledList( ) [0]; + device->setLedState( led, Led_Off ); + } + } + // go trough accounts and check here - // depending on result show or hide // also trigger qcop call and save status to config - // get led to blink } diff --git a/noncore/net/mail/taskbarapplet/mailapplet.h b/noncore/net/mail/taskbarapplet/mailapplet.h index 1c48b29..34bdc22 100644 --- a/noncore/net/mail/taskbarapplet/mailapplet.h +++ b/noncore/net/mail/taskbarapplet/mailapplet.h @@ -11,7 +11,7 @@ class MailApplet : public QButton { Q_OBJECT public: - MailApplet(QWidget *parent = 0, const char *name = 0, WFlags fl = 0); + MailApplet( QWidget *parent = 0, const char *name = 0, WFlags fl = 0 ); protected: void drawButton(QPainter *); -- cgit v0.9.0.2