Esempio n. 1
0
 void SyndicationPlugin::load()
 {
     activity = new SyndicationActivity(this, 0);
     connect(add_feed, SIGNAL(triggered()), activity, SLOT(addFeed()));
     connect(remove_feed, SIGNAL(triggered()), activity, SLOT(removeFeed()));
     connect(manage_filters, SIGNAL(triggered()), activity, SLOT(manageFilters()));
     connect(add_filter, SIGNAL(triggered()), activity, SLOT(addFilter()));
     connect(remove_filter, SIGNAL(triggered()), activity, SLOT(removeFilter()));
     connect(edit_filter, SIGNAL(triggered()), activity, SLOT(editFilter()));
     connect(edit_feed_name, SIGNAL(triggered()), activity, SLOT(editFeedName()));
     getGUI()->addActivity(activity);
     activity->loadState(KGlobal::config());
 }
Esempio n. 2
0
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
}