LDPlugin::LDPlugin(QWidget *parent, QString id) : QFrame(parent){ PLUGID=id; prefix = id.replace("/","_")+"/"; //qDebug() << "ID:" << PLUGID << prefix; settings = LSession::handle()->DesktopPluginSettings(); //Use plugin-specific values for stylesheet control (applauncher, desktopview, etc...) this->setObjectName(id.section("---",0,0).section("::",0,0)); connect(QApplication::instance(), SIGNAL(LocaleChanged()), this, SLOT(LocaleChange()) ); connect(QApplication::instance(), SIGNAL(IconThemeChanged()), this, SLOT(ThemeChange()) ); }
RSSFeedPlugin::RSSFeedPlugin(QWidget* parent, QString ID) : LDPlugin(parent, ID), ui(new Ui::RSSFeedPlugin()){ ui->setupUi(this); //Load the global settings setprefix = "rssreader/"; //this structure/prefix should be used for *all* plugins of this type RSS = new RSSReader(this, setprefix); //Create the options menu optionsMenu = new QMenu(this); ui->tool_options->setMenu(optionsMenu); presetMenu = new QMenu(this); ui->tool_add_preset->setMenu(presetMenu); //Setup any signal/slot connections connect(ui->push_back1, SIGNAL(clicked()), this, SLOT(backToFeeds()) ); connect(ui->push_back2, SIGNAL(clicked()), this, SLOT(backToFeeds()) ); connect(ui->push_back3, SIGNAL(clicked()), this, SLOT(backToFeeds()) ); connect(ui->push_save_settings, SIGNAL(clicked()), this, SLOT(saveSettings()) ); connect(RSS, SIGNAL(rssChanged(QString)), this, SLOT(RSSItemChanged(QString)) ); connect(RSS, SIGNAL(newChannelsAvailable()), this, SLOT(UpdateFeedList())); connect(ui->tool_gotosite, SIGNAL(clicked()), this, SLOT(openFeedPage()) ); connect(ui->push_rm_feed, SIGNAL(clicked()), this, SLOT(removeFeed()) ); connect(ui->push_add_url, SIGNAL(clicked()), this, SLOT(addNewFeed()) ); connect(ui->combo_feed, SIGNAL(currentIndexChanged(int)), this, SLOT(currentFeedChanged()) ); connect(presetMenu, SIGNAL(triggered(QAction*)), this, SLOT(loadPreset(QAction*)) ); updateOptionsMenu(); QTimer::singleShot(0,this, SLOT(ThemeChange()) ); //qDebug() << " - Done with init"; QStringList feeds; if( !LSession::handle()->DesktopPluginSettings()->contains(setprefix+"currentfeeds") ){ //First-time run of the plugin - automatically load the default feeds feeds = LOS::RSSFeeds(); for(int i=0; i<feeds.length(); i++){ feeds[i] = feeds[i].section("::::",1,-1); } //just need url right now feeds << "http://lumina-desktop.org/?feed=rss2"; //Lumina Desktop blog feed LSession::handle()->DesktopPluginSettings()->setValue(setprefix+"currentfeeds", feeds); }else{ feeds = LSession::handle()->DesktopPluginSettings()->value(setprefix+"currentfeeds",QStringList()).toStringList(); } RSS->addUrls(feeds); backToFeeds(); //always load the first page }
LClock::LClock(QWidget *parent, QString id, bool horizontal) : LPPlugin(parent, id, horizontal){ button = new QToolButton(this); //RotateToolButton(this); button->setAutoRaise(true); button->setToolButtonStyle(Qt::ToolButtonTextOnly); button->setStyleSheet("font-weight: bold;"); button->setPopupMode(QToolButton::DelayedPopup); //make sure it runs the update routine first button->setMenu(new QMenu()); //button->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred); //this->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred); connect(button, SIGNAL(clicked()), this, SLOT(openMenu())); connect(button->menu(), SIGNAL(aboutToHide()), this, SIGNAL(MenuClosed())); calendar = new QCalendarWidget(this); calAct = new QWidgetAction(this); calAct->setDefaultWidget(calendar); TZMenu = new QMenu(this); connect(TZMenu, SIGNAL(triggered(QAction*)), this, SLOT(ChangeTZ(QAction*)) ); //Now assemble the menu button->menu()->addAction(calAct); button->menu()->addMenu(TZMenu); this->layout()->setContentsMargins(0,0,0,0); //reserve some space on left/right this->layout()->addWidget(button); //Setup the timer timer = new QTimer(); //Load all the initial settings updateFormats(); LocaleChange(); ThemeChange(); OrientationChange(); //Now connect/start the timer connect(timer,SIGNAL(timeout()), this, SLOT(updateTime()) ); connect(QApplication::instance(), SIGNAL(SessionConfigChanged()), this, SLOT(updateFormats()) ); timer->start(); }
void LPanel::UpdateTheme(){ //The panel itself has no theme-based icons, just forward the signal to all the plugins for(int i=0; i<PLUGINS.length(); i++){ QTimer::singleShot(1,PLUGINS[i], SLOT(ThemeChange())); } }