void MainWindow::topMenuTreatment(QAction *action) { if (action && action->text()=="Export to XML") { exportToXml(); } if (action && action->text()=="Import XML") { importXml(); } }
StreamsBrowsePage::StreamsBrowsePage(QWidget *p) : SinglePageWidget(p) , settings(0) { importAction = new Action(Icon("document-import"), i18n("Import Streams Into Favorites"), this); exportAction = new Action(Icon("document-export"), i18n("Export Favorite Streams"), this); addAction = ActionCollection::get()->createAction("addstream", i18n("Add New Stream To Favorites"), Icons::self()->addRadioStreamIcon); editAction = new Action(Icons::self()->editIcon, i18n("Edit"), this); searchAction = new Action(Icons::self()->searchIcon, i18n("Seatch For Streams"), this); connect(searchAction, SIGNAL(triggered()), this, SIGNAL(searchForStreams())); // connect(view, SIGNAL(itemsSelected(bool)), addToPlaylist, SLOT(setEnabled(bool))); connect(view, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(itemDoubleClicked(const QModelIndex &))); connect(view, SIGNAL(itemsSelected(bool)), SLOT(controlActions())); connect(addAction, SIGNAL(triggered()), this, SLOT(addStream())); connect(StreamsModel::self()->addBookmarkAct(), SIGNAL(triggered()), this, SLOT(addBookmark())); connect(StreamsModel::self()->configureDiAct(), SIGNAL(triggered()), this, SLOT(configureDi())); connect(StreamsModel::self()->reloadAct(), SIGNAL(triggered()), this, SLOT(reload())); connect(editAction, SIGNAL(triggered()), this, SLOT(edit())); connect(importAction, SIGNAL(triggered()), this, SLOT(importXml())); connect(exportAction, SIGNAL(triggered()), this, SLOT(exportXml())); connect(StreamsModel::self(), SIGNAL(error(const QString &)), this, SIGNAL(error(const QString &))); connect(StreamsModel::self(), SIGNAL(loading()), view, SLOT(showSpinner())); connect(StreamsModel::self(), SIGNAL(loaded()), view, SLOT(hideSpinner())); connect(StreamsModel::self(), SIGNAL(categoriesChanged()), view, SLOT(closeSearch())); connect(StreamsModel::self(), SIGNAL(favouritesLoaded()), SLOT(expandFavourites())); connect(StreamsModel::self(), SIGNAL(addedToFavourites(QString)), SLOT(addedToFavourites(QString))); connect(DigitallyImported::self(), SIGNAL(loginStatus(bool,QString)), SLOT(updateDiStatus())); connect(DigitallyImported::self(), SIGNAL(updated()), SLOT(updateDiStatus())); connect(view, SIGNAL(headerClicked(int)), SLOT(headerClicked(int))); StreamsModel::self()->configureDiAct()->setEnabled(false); proxy.setSourceModel(StreamsModel::self()); view->setModel(&proxy); view->setDeleteAction(StdActions::self()->removeAction); view->setSearchResetLevel(1); view->alwaysShowHeader(); Configuration config(metaObject()->className()); view->setMode(ItemView::Mode_DetailedTree); view->load(config); MenuButton *menuButton=new MenuButton(this); Action *configureAction=new Action(Icons::self()->configureIcon, i18n("Configure"), this); connect(configureAction, SIGNAL(triggered()), SLOT(configure())); menuButton->addAction(createViewMenu(QList<ItemView::Mode>() << ItemView::Mode_BasicTree << ItemView::Mode_SimpleTree << ItemView::Mode_DetailedTree << ItemView::Mode_List)); menuButton->addAction(configureAction); menuButton->addAction(StreamsModel::self()->configureDiAct()); menuButton->addSeparator(); menuButton->addAction(addAction); menuButton->addAction(StdActions::self()->removeAction); menuButton->addAction(editAction); menuButton->addAction(StreamsModel::self()->reloadAct()); menuButton->addSeparator(); menuButton->addAction(importAction); menuButton->addAction(exportAction); diStatusLabel=new ServiceStatusLabel(this); diStatusLabel->setText("DI", i18nc("Service name", "Digitally Imported")); connect(diStatusLabel, SIGNAL(clicked()), SLOT(diSettings())); updateDiStatus(); ToolButton *searchButton=new ToolButton(this); searchButton->setDefaultAction(searchAction); init(ReplacePlayQueue, QList<QWidget *>() << menuButton << diStatusLabel, QList<QWidget *>() << searchButton); view->addAction(editAction); view->addAction(StdActions::self()->removeAction); view->addAction(StreamsModel::self()->addToFavouritesAct()); view->addAction(StreamsModel::self()->addBookmarkAct()); view->addAction(StreamsModel::self()->reloadAct()); }