Implement #1319 (Option to disable minimise-to-system-tray needed)

This commit is contained in:
Kovid Goyal 2008-11-28 13:01:17 -08:00
parent 6e0b40dac5
commit 5dac2771b1
4 changed files with 15 additions and 7 deletions

View File

@ -53,6 +53,7 @@ def _config():
help=_('Columns to be displayed in the book list'))
c.add_opt('autolaunch_server', default=False, help=_('Automatically launch content server on application startup'))
c.add_opt('oldest_news', default=60, help=_('Oldest news kept in database'))
c.add_opt('systray_icon', default=True, help=_('Show system tray icon'))
return ConfigProxy(c)
config = _config()

View File

@ -117,6 +117,7 @@ class ConfigDialog(QDialog, Ui_Dialog):
self.username.setText(opts.username)
self.password.setText(opts.password if opts.password else '')
self.auto_launch.setChecked(config['autolaunch_server'])
self.systray_icon.setChecked(config['systray_icon'])
def up_column(self):
idx = self.columns.currentRow()
@ -217,6 +218,7 @@ class ConfigDialog(QDialog, Ui_Dialog):
config['save_to_disk_single_format'] = BOOK_EXTENSIONS[self.single_format.currentIndex()]
config['cover_flow_queue_length'] = self.cover_browse.value()
prefs['language'] = str(self.language.itemData(self.language.currentIndex()).toString())
config['systray_icon'] = self.systray_icon.checkState() == Qt.Checked
config['autolaunch_server'] = self.auto_launch.isChecked()
sc = server_config()
sc.set('username', unicode(self.username.text()).strip())

View File

@ -72,7 +72,7 @@
<item>
<widget class="QStackedWidget" name="stackedWidget" >
<property name="currentIndex" >
<number>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="page_3" >
<layout class="QVBoxLayout" name="verticalLayout" >
@ -357,7 +357,7 @@
</property>
</widget>
</item>
<item row="1" column="0" >
<item row="2" column="0" >
<layout class="QHBoxLayout" name="horizontalLayout" >
<item>
<widget class="QLabel" name="label_6" >
@ -374,7 +374,7 @@
</item>
</layout>
</item>
<item row="2" column="0" >
<item row="3" column="0" >
<widget class="QGroupBox" name="groupBox_2" >
<property name="title" >
<string>Toolbar</string>
@ -422,7 +422,7 @@
</layout>
</widget>
</item>
<item row="3" column="0" >
<item row="4" column="0" >
<widget class="QGroupBox" name="groupBox" >
<property name="title" >
<string>Select visible &amp;columns in library view</string>
@ -503,6 +503,13 @@
</layout>
</widget>
</item>
<item row="1" column="0" >
<widget class="QCheckBox" name="systray_icon" >
<property name="text" >
<string>Enable system &amp;tray icon (needs restart)</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="page_2" >

View File

@ -91,7 +91,7 @@ class Main(MainWindow, Ui_MainWindow):
self.viewers = collections.deque()
self.content_server = None
self.system_tray_icon = QSystemTrayIcon(QIcon(':/library'), self)
if opts.no_systray:
if not config['systray_icon']:
self.system_tray_icon.hide()
else:
self.system_tray_icon.show()
@ -1337,8 +1337,6 @@ path_to_ebook to the database.
help=_('Use the library located at the specified path.'))
parser.add_option('-v', '--verbose', default=0, action='count',
help=_('Log debugging information to console'))
parser.add_option('--no-systray', default=False, action='store_true',
help=_('Disable system tray icon'))
return parser
def main(args=sys.argv):