diff options
Diffstat (limited to 'lumina-desktop')
-rw-r--r-- | lumina-desktop/LSession.cpp | 2 | ||||
-rw-r--r-- | lumina-desktop/LSession.h | 2 | ||||
-rw-r--r-- | lumina-desktop/panel-plugins/clock/LClock.cpp | 23 | ||||
-rw-r--r-- | lumina-desktop/panel-plugins/clock/LClock.h | 5 |
4 files changed, 26 insertions, 6 deletions
diff --git a/lumina-desktop/LSession.cpp b/lumina-desktop/LSession.cpp index 7016a2b7..91ecd98f 100644 --- a/lumina-desktop/LSession.cpp +++ b/lumina-desktop/LSession.cpp @@ -111,6 +111,7 @@ void LSession::setupSession(){ if(DEBUG){ qDebug() << " - Init QFileSystemWatcher:" << timer->elapsed();} watcher = new QFileSystemWatcher(this); //watcher->addPath( QDir::homePath()+"/.lumina/stylesheet.qss" ); + watcher->addPath( QDir::homePath()+"/.lumina/LuminaDE/sessionsettings.conf" ); watcher->addPath( QDir::homePath()+"/.lumina/LuminaDE/desktopsettings.conf" ); watcher->addPath( QDir::homePath()+"/.lumina/fluxbox-init" ); watcher->addPath( QDir::homePath()+"/.lumina/fluxbox-keys" ); @@ -185,6 +186,7 @@ void LSession::launchStartupApps(){ void LSession::watcherChange(QString changed){ if(DEBUG){ qDebug() << "Session Watcher Change:" << changed; } if(changed.endsWith("fluxbox-init") || changed.endsWith("fluxbox-keys")){ refreshWindowManager(); } + else if(changed.endsWith("sessionsettings.conf") ){ sessionsettings->sync(); emit SessionConfigChanged(); } else{ emit DesktopConfigChanged(); } } diff --git a/lumina-desktop/LSession.h b/lumina-desktop/LSession.h index 6dd99b55..03a4b397 100644 --- a/lumina-desktop/LSession.h +++ b/lumina-desktop/LSession.h @@ -141,7 +141,9 @@ signals: void WindowListEvent(); //General Signals void LocaleChanged(); + void IconThemeChanged(); void DesktopConfigChanged(); + void SessionConfigChanged(); }; diff --git a/lumina-desktop/panel-plugins/clock/LClock.cpp b/lumina-desktop/panel-plugins/clock/LClock.cpp index a61eb75d..e66d83c2 100644 --- a/lumina-desktop/panel-plugins/clock/LClock.cpp +++ b/lumina-desktop/panel-plugins/clock/LClock.cpp @@ -6,6 +6,8 @@ //=========================================== #include "LClock.h" +#include "LSession.h" + LClock::LClock(QWidget *parent, QString id, bool horizontal) : LPPlugin(parent, id, horizontal){ //Setup the widget label = new QLabel(this); @@ -15,9 +17,11 @@ LClock::LClock(QWidget *parent, QString id, bool horizontal) : LPPlugin(parent, //Setup the timer timer = new QTimer(); - timer->setInterval(1000); //update once a second - connect(timer,SIGNAL(timeout()), this, SLOT(updateTime()) ); + timer->setInterval(1000); //update once a second + updateFormats(); updateTime(); + connect(timer,SIGNAL(timeout()), this, SLOT(updateTime()) ); + connect(QApplication::instance(), SIGNAL(SessionConfigChanged()), this, SLOT(updateFormats()) ); timer->start(); } @@ -26,10 +30,19 @@ LClock::~LClock(){ delete timer; } + void LClock::updateTime(){ QDateTime CT = QDateTime::currentDateTime(); //Now update the display - QLocale sys = QLocale::system(); - label->setText( "<b>"+CT.toString(sys.timeFormat(QLocale::ShortFormat))+"</b>" ); - label->setToolTip(CT.toString(sys.dateFormat())); + if(deftime){ label->setText( "<b>"+CT.time().toString(Qt::SystemLocaleShortDate)+"</b>" ); } + else{ label->setText( "<b>"+CT.toString(timefmt)+"</b>" ); } + if(defdate){ label->setToolTip(CT.date().toString(Qt::SystemLocaleLongDate)); } + else{ label->setToolTip(CT.toString(datefmt)); } } + +void LClock::updateFormats(){ + timefmt = LSession::handle()->sessionSettings()->value("TimeFormat","").toString(); + datefmt = LSession::handle()->sessionSettings()->value("DateFormat","").toString(); + deftime = timefmt.simplified().isEmpty(); + defdate = datefmt.simplified().isEmpty(); +}
\ No newline at end of file diff --git a/lumina-desktop/panel-plugins/clock/LClock.h b/lumina-desktop/panel-plugins/clock/LClock.h index d4de917c..8f7e38eb 100644 --- a/lumina-desktop/panel-plugins/clock/LClock.h +++ b/lumina-desktop/panel-plugins/clock/LClock.h @@ -25,9 +25,12 @@ public: private: QTimer *timer; QLabel *label; - + QString timefmt, datefmt; + bool deftime, defdate; + private slots: void updateTime(); + void updateFormats(); }; |