From 9ae977c313e2047fba473e65f2321c325fa137b5 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 18 Aug 2015 14:33:34 -0700 Subject: Update the arrangement of the available time zones in the clock plugin. Now it is organized by: Continent -> Country -> City --- lumina-desktop/panel-plugins/clock/LClock.cpp | 62 ++++++++++++++++++++++++--- 1 file changed, 57 insertions(+), 5 deletions(-) (limited to 'lumina-desktop') diff --git a/lumina-desktop/panel-plugins/clock/LClock.cpp b/lumina-desktop/panel-plugins/clock/LClock.cpp index 9791f927..f704647e 100644 --- a/lumina-desktop/panel-plugins/clock/LClock.cpp +++ b/lumina-desktop/panel-plugins/clock/LClock.cpp @@ -102,7 +102,6 @@ void LClock::updateTime(bool adjustformat){ }*/ } button->setText(label); - //labelWidget->setText(label); } @@ -148,9 +147,62 @@ void LClock::LocaleChange(){ TZMenu->addAction(tr("Use System Time")); TZMenu->addSeparator(); QList TZList = QTimeZone::availableTimeZoneIds(); - //qDebug() << "Found Time Zones:" << TZList.length(); - QDateTime cur = QDateTime::currentDateTime(); + //Orgnize time zones for smaller menus (Continent/Country/City) + // Note: id = Continent/City + QStringList info; + for(int i=0; iisEmpty()){ + tmpC->addMenu(tmpCM); + } + if(!tmpC->isEmpty()){ TZMenu->addMenu(tmpC); } + } + tmpC = new QMenu(this); + tmpC->setTitle(info[i].section("::::",1,1)); + tmpCM = new QMenu(this); + tmpCM->setTitle(info[i].section("::::",2,2)); + //Check if different country + }else if(info[i].section("::::",2,2)!=country){ + if(tmpC!=0 && tmpCM!=0 && !tmpCM->isEmpty()){ + tmpC->addMenu(tmpCM); + } + tmpCM = new QMenu(this); + tmpCM->setTitle(info[i].section("::::",2,2)); + } + //Now create the entry within the country menu + if(tmpCM!=0){ + QAction *act = new QAction(info[i].section("::::",3,3), this); + act->setWhatsThis(info[i].section("::::",4,4) ); + tmpCM->addAction(act); + } + //Save the values for the next run + continent = info[i].section("::::",1,1); + country = info[i].section("::::",2,2); + if(i== info.length()-1){ + //last go through - save all menus + if(tmpCM!=0 && tmpC!=0 && !tmpCM->isEmpty()){ tmpC->addMenu(tmpCM); } + if(tmpC!=0 && !tmpC->isEmpty()){ TZMenu->addMenu(tmpC); } + } + } + + //qDebug() << "Found Time Zones:" << TZList.length(); + /*QDateTime cur = QDateTime::currentDateTime(); + + QMenu *tmpCM = 0; QString ccat; //current category QStringList catAbb; for(int i=0; isetTitle(ccat); @@ -187,7 +239,7 @@ void LClock::LocaleChange(){ tmpM->addAction(act); } TZMenu->addMenu(tmpM); - } + }*/ } -- cgit