changeset 39:0c2578196643

Disable the article menu by default, enable it when the first article is selected
author Dirk Olmes <dirk@xanthippe.ping.de>
date Fri, 14 May 2010 06:48:48 +0200
parents 11bac653edfd
children c858aab71e5b
files MainWindow.py Ui_MainWindow.ui
diffstat 2 files changed, 67 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/MainWindow.py	Fri May 14 06:40:12 2010 +0200
+++ b/MainWindow.py	Fri May 14 06:48:48 2010 +0200
@@ -37,6 +37,7 @@
         self.ui.feedEntryList.update()
         
     def feedEntrySelected(self, index):
+        self.ui.menuArticle.setEnabled(True)
         row = index.row()
         self.selectedEntry = self.sortedEntries[row]
         baseUrl = QUrl(self.selectedEntry.link) # TODO this is the wrong base url, figure out the correct one
@@ -56,10 +57,15 @@
             # TODO get status from feedUpdater and display in status area of the main window
             self.updateFeedList()
 
-    def openSelectedEntry(self):
+    def openSelectedEntryInBrowser(self):
         # TODO make browser configurable
         browser = "/usr/local/bin/opera"
         subprocess.Popen([browser, self.selectedEntry.link])
+        
+    def openLinkFromSelectedEntry(self):
+        url = QUrl(self.selectedEntry.link)
+        self.ui.webView.load(url)
+        self.ui.webView.show()
 
 class FeedEntryItemDelegate(QtGui.QStyledItemDelegate):
     def __init__(self):
--- a/Ui_MainWindow.ui	Fri May 14 06:40:12 2010 +0200
+++ b/Ui_MainWindow.ui	Fri May 14 06:48:48 2010 +0200
@@ -62,17 +62,29 @@
     <property name="title">
      <string>Feed</string>
     </property>
-    <addaction name="actionAdd"/>
-    <addaction name="separator"/>
-    <addaction name="actionQuit"/>
+    <addaction name="actionAddFeed"/>
+    <addaction name="actionFeedSettings"/>
    </widget>
    <widget class="QMenu" name="menuArticle">
+    <property name="enabled">
+     <bool>false</bool>
+    </property>
     <property name="title">
      <string>Article</string>
     </property>
     <addaction name="actionMarkSelectedRead"/>
+    <addaction name="actionOpenLink"/>
     <addaction name="actionOpenInBrowser"/>
    </widget>
+   <widget class="QMenu" name="menuFeedworm">
+    <property name="title">
+     <string>Feedworm</string>
+    </property>
+    <addaction name="actionPreferences"/>
+    <addaction name="separator"/>
+    <addaction name="actionQuit"/>
+   </widget>
+   <addaction name="menuFeedworm"/>
    <addaction name="menuFeed"/>
    <addaction name="menuArticle"/>
   </widget>
@@ -85,7 +97,7 @@
     <string>Ctrl+Q</string>
    </property>
   </action>
-  <action name="actionAdd">
+  <action name="actionAddFeed">
    <property name="text">
     <string>Add ...</string>
    </property>
@@ -114,6 +126,30 @@
     <string>Ctrl+O</string>
    </property>
   </action>
+  <action name="actionOpenLink">
+   <property name="text">
+    <string>Open link</string>
+   </property>
+   <property name="shortcut">
+    <string>L</string>
+   </property>
+  </action>
+  <action name="actionPreferences">
+   <property name="enabled">
+    <bool>false</bool>
+   </property>
+   <property name="text">
+    <string>Preferences</string>
+   </property>
+  </action>
+  <action name="actionFeedSettings">
+   <property name="enabled">
+    <bool>false</bool>
+   </property>
+   <property name="text">
+    <string>Settings ...</string>
+   </property>
+  </action>
  </widget>
  <customwidgets>
   <customwidget>
@@ -141,7 +177,7 @@
    </hints>
   </connection>
   <connection>
-   <sender>actionAdd</sender>
+   <sender>actionAddFeed</sender>
    <signal>activated()</signal>
    <receiver>MainWindow</receiver>
    <slot>addFeed()</slot>
@@ -205,10 +241,26 @@
    </hints>
   </connection>
   <connection>
+   <sender>actionOpenLink</sender>
+   <signal>activated()</signal>
+   <receiver>MainWindow</receiver>
+   <slot>openLinkFromSelectedEntry()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>-1</x>
+     <y>-1</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>495</x>
+     <y>374</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
    <sender>actionOpenInBrowser</sender>
    <signal>activated()</signal>
    <receiver>MainWindow</receiver>
-   <slot>openSelectedEntry()</slot>
+   <slot>openSelectedEntryInBrowser()</slot>
    <hints>
     <hint type="sourcelabel">
      <x>-1</x>
@@ -226,6 +278,7 @@
   <slot>feedSelected(QModelIndex)</slot>
   <slot>feedEntrySelected(QModelIndex)</slot>
   <slot>toggleReadOnSelectedEntry()</slot>
-  <slot>openSelectedEntry()</slot>
+  <slot>openSelectedEntryInBrowser()</slot>
+  <slot>openLinkFromSelectedEntry()</slot>
  </slots>
 </ui>