This commit is contained in:
Martin Rotter 2013-12-09 16:05:16 +01:00
parent 431b668f28
commit 8092177fa8
6 changed files with 87 additions and 63 deletions

View File

@ -2,9 +2,11 @@
#include <QAction>
#include <QLabel>
#include <QSpacerItem>
#include <QPalette>
#include "gui/dynamicshortcutswidget.h"
#include "gui/shortcutcatcher.h"
#include "gui/shortcutbutton.h"
DynamicShortcutsWidget::DynamicShortcutsWidget(QWidget *parent) : QWidget(parent) {
@ -26,8 +28,8 @@ bool DynamicShortcutsWidget::areShortcutsUnique() {
foreach (const ActionBinding &binding, m_actionBindings) {
QKeySequence new_shortcut = binding.second->shortcut();
if (all_shortcuts.contains(new_shortcut)) {
// Problem, two identical shortcuts found.
if (all_shortcuts.contains(new_shortcut) && !new_shortcut.isEmpty()) {
// Problem, two identical non-empty shortcuts found.
return false;
}
else {

View File

@ -81,6 +81,8 @@ FormSettings::FormSettings(QWidget *parent) : QDialog(parent), m_ui(new Ui::Form
this, SLOT(changeBrowserProgressColor()));
connect(m_ui->m_treeSkins, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)),
this, SLOT(onSkinSelected(QTreeWidgetItem*,QTreeWidgetItem*)));
connect(m_ui->m_cmbExternalBrowserPreset, SIGNAL(currentIndexChanged(int)),
this, SLOT(changeDefaultBrowserArguments(int)));
// Load all settings.
loadGeneral();
@ -89,12 +91,19 @@ FormSettings::FormSettings(QWidget *parent) : QDialog(parent), m_ui(new Ui::Form
loadProxy();
loadBrowser();
loadLanguage();
loadFeedsMessages();
}
FormSettings::~FormSettings() {
delete m_ui;
}
void FormSettings::changeDefaultBrowserArguments(int index) {
if (index != 0) {
m_ui->m_txtExternalBrowserArguments->setText(m_ui->m_cmbExternalBrowserPreset->itemData(index).toString());
}
}
void FormSettings::onSkinSelected(QTreeWidgetItem *current,
QTreeWidgetItem *previous) {
Q_UNUSED(previous);
@ -114,6 +123,14 @@ void FormSettings::changeBrowserProgressColor() {
m_initialSettings.m_webBrowserProgress = color_dialog.selectedColor();
}
void FormSettings::loadFeedsMessages() {
m_ui->m_cmbExternalBrowserPreset->addItem("Chromium", "aa %1");
}
void FormSettings::saveFeedsMessages() {
}
void FormSettings::displayProxyPassword(int state) {
if (state == Qt::Checked) {
m_ui->m_txtProxyPassword->setEchoMode(QLineEdit::Normal);
@ -192,6 +209,7 @@ void FormSettings::saveSettings() {
saveProxy();
saveBrowser();
saveLanguage();
saveFeedsMessages();
Settings::getInstance()->checkSettings();
promptForRestart();
@ -353,17 +371,17 @@ void FormSettings::loadGeneral() {
// Load auto-start status.
SystemFactory::AutoStartStatus autostart_status = SystemFactory::getAutoStartStatus();
switch (autostart_status) {
case SystemFactory::Enabled:
m_ui->m_checkAutostart->setChecked(true);
break;
case SystemFactory::Disabled:
m_ui->m_checkAutostart->setChecked(false);
break;
default:
m_ui->m_checkAutostart->setEnabled(false);
m_ui->m_checkAutostart->setText(m_ui->m_checkAutostart->text() +
tr(" (not supported on this platform)"));
break;
case SystemFactory::Enabled:
m_ui->m_checkAutostart->setChecked(true);
break;
case SystemFactory::Disabled:
m_ui->m_checkAutostart->setChecked(false);
break;
default:
m_ui->m_checkAutostart->setEnabled(false);
m_ui->m_checkAutostart->setText(m_ui->m_checkAutostart->text() +
tr(" (not supported on this platform)"));
break;
}
}
@ -455,7 +473,6 @@ void FormSettings::loadInterface() {
m_ui->m_treeSkins->addTopLevelItem(new_item);
if (skin.m_baseName == selected_skin) {
m_initialSettings.m_skin = selected_skin;
m_ui->m_treeSkins->setCurrentItem(new_item);
m_ui->m_lblActiveContents->setText(skin.m_visibleName);
}

View File

@ -15,12 +15,10 @@ struct TemporarySettings {
public:
TemporarySettings()
: m_webBrowserProgress(QColor()),
m_skin(QString()) {
: m_webBrowserProgress(QColor()) {
}
QColor m_webBrowserProgress;
QString m_skin;
};
class FormSettings : public QDialog {
@ -63,6 +61,10 @@ class FormSettings : public QDialog {
void saveProxy();
void displayProxyPassword(int state);
void loadFeedsMessages();
void saveFeedsMessages();
void changeDefaultBrowserArguments(int index);
void onProxyTypeChanged(int index);
private:

View File

@ -147,8 +147,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>195</width>
<height>238</height>
<width>167</width>
<height>219</height>
</rect>
</property>
<layout class="QFormLayout" name="formLayout">
@ -663,59 +663,23 @@
<string>Messages</string>
</attribute>
<layout class="QFormLayout" name="formLayout_10">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="0" column="0" colspan="2">
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>External web browser for message viewing</string>
</property>
<layout class="QFormLayout" name="formLayout_11">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="m_lblExternalBrowserPreset">
<property name="text">
<string>Preset</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="m_cmbExternalBrowserPreset">
<item>
<property name="text">
<string>custom</string>
</property>
</item>
<item>
<property name="text">
<string>Chromium</string>
</property>
</item>
<item>
<property name="text">
<string>Google Chrome</string>
</property>
</item>
<item>
<property name="text">
<string>Opera</string>
</property>
</item>
<item>
<property name="text">
<string>Mozilla Firefox</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="m_lblExternalBrowserExecutable">
<property name="text">
<string>Web browser executable</string>
</property>
</widget>
</item>
<item row="1" column="1">
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_10">
<item>
<widget class="QLineEdit" name="m_txtExternalBrowserExecutable"/>
@ -729,15 +693,48 @@
</item>
</layout>
</item>
<item row="2" column="0">
<item row="1" column="0">
<widget class="QLabel" name="m_lblExternalBrowserArguments">
<property name="text">
<string>Executable arguments</string>
<string>Executable parameters</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="m_txtExternalBrowserArguments"/>
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_11">
<item>
<widget class="QLineEdit" name="m_txtExternalBrowserArguments"/>
</item>
<item>
<widget class="QLabel" name="m_lblExternalBrowserPreset">
<property name="text">
<string>use sample arguments for</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="m_cmbExternalBrowserPreset">
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToContentsOnFirstShow</enum>
</property>
<item>
<property name="text">
<string>select browser</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item row="2" column="0" colspan="2">
<widget class="QLabel" name="label">
<property name="text">
<string>Note that &quot;%1&quot; (without quotation marks) is placeholder for URL of selected message.</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</widget>

View File

@ -99,6 +99,10 @@ void MessagesView::selectionChanged(const QItemSelection &selected,
void MessagesView::keyPressEvent(QKeyEvent *event) {
QTreeView::keyPressEvent(event);
if (event->key() == Qt::Key_Delete) {
deleteSelectedMessages();
}
}
void MessagesView::contextMenuEvent(QContextMenuEvent *event) {

View File

@ -38,7 +38,9 @@ class ShortcutButton;
class ShortcutCatcher : public QWidget {
Q_OBJECT
friend class ShortcutButton;
friend class DynamicShortcutsWidget;
public:
// Constructors and destructors.