Browse Source

- Improved right click menu in RSS streams list

adaptive-webui-19844
Christophe Dumez 18 years ago
parent
commit
9a4466e74f
  1. 4
      src/rss.ui
  2. 9
      src/rss_imp.cpp
  3. 2
      src/rss_imp.h

4
src/rss.ui

@ -225,12 +225,12 @@
</action> </action>
<action name="actionCreate" > <action name="actionCreate" >
<property name="text" > <property name="text" >
<string>Create</string> <string>Add RSS stream</string>
</property> </property>
</action> </action>
<action name="actionRefreshAll" > <action name="actionRefreshAll" >
<property name="text" > <property name="text" >
<string>RefreshAll</string> <string>Refresh all streams</string>
</property> </property>
</action> </action>
</widget> </widget>

9
src/rss_imp.cpp

@ -26,16 +26,17 @@
#include <QStandardItemModel> #include <QStandardItemModel>
// display a right-click menu // display a right-click menu
void RSSImp::displayFinishedListMenu(const QPoint& pos){ void RSSImp::displayRSSListMenu(const QPoint& pos){
QMenu myFinishedListMenu(this); QMenu myFinishedListMenu(this);
QListWidgetItem* item = listStreams->itemAt(pos); QListWidgetItem* item = listStreams->itemAt(pos);
if(item!=NULL) { if(item!=NULL) {
myFinishedListMenu.addAction(actionDelete); myFinishedListMenu.addAction(actionDelete);
myFinishedListMenu.addAction(actionRename); myFinishedListMenu.addAction(actionRename);
myFinishedListMenu.addAction(actionRefresh); myFinishedListMenu.addAction(actionRefresh);
}else{
myFinishedListMenu.addAction(actionCreate);
myFinishedListMenu.addAction(actionRefreshAll);
} }
myFinishedListMenu.addAction(actionCreate);
myFinishedListMenu.addAction(actionRefreshAll);
myFinishedListMenu.exec(mapToGlobal(pos)+QPoint(10,33)); myFinishedListMenu.exec(mapToGlobal(pos)+QPoint(10,33));
} }
@ -236,7 +237,7 @@
addStream_button->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/add.png"))); addStream_button->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/add.png")));
delStream_button->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/remove.png"))); delStream_button->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/remove.png")));
refreshAll_button->setIcon(QIcon(QString::fromUtf8(":/Icons/exec.png"))); refreshAll_button->setIcon(QIcon(QString::fromUtf8(":/Icons/exec.png")));
connect(listStreams, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(displayFinishedListMenu(const QPoint&))); connect(listStreams, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(displayRSSListMenu(const QPoint&)));
connect(actionDelete, SIGNAL(triggered()), this, SLOT(deleteStream())); connect(actionDelete, SIGNAL(triggered()), this, SLOT(deleteStream()));
connect(actionRename, SIGNAL(triggered()), this, SLOT(renameStream())); connect(actionRename, SIGNAL(triggered()), this, SLOT(renameStream()));
connect(actionRefresh, SIGNAL(triggered()), this, SLOT(refreshStream())); connect(actionRefresh, SIGNAL(triggered()), this, SLOT(refreshStream()));

2
src/rss_imp.h

@ -41,7 +41,7 @@ class RSSImp : public QWidget, public Ui::RSS{
void on_listStreams_clicked(); void on_listStreams_clicked();
void on_listNews_clicked(); void on_listNews_clicked();
void on_listNews_doubleClicked(); void on_listNews_doubleClicked();
void displayFinishedListMenu(const QPoint&); void displayRSSListMenu(const QPoint&);
void deleteStream(); void deleteStream();
void renameStream(); void renameStream();
void refreshStream(); void refreshStream();

Loading…
Cancel
Save