summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVyacheslav Matyushin <[email protected]>2015-07-10 00:40:53 +0300
committerVyacheslav Matyushin <[email protected]>2015-07-10 00:40:53 +0300
commit05fb1a079d4237bb85b458324500449ce68edb23 (patch)
treedd1b596ce9df04795fa510705d59c4caf48de1e0
parent3c77f8472a1bb0e2ca18bb33013c255ab7668ae7 (diff)
Added warning widget about missing log file to XSession mode.
-rw-r--r--src/modes/xsession/xsessionConfigurationWidget.h36
-rw-r--r--src/modes/xsession/xsessionConfigurationWidgetBase.ui87
2 files changed, 60 insertions, 63 deletions
diff --git a/src/modes/xsession/xsessionConfigurationWidget.h b/src/modes/xsession/xsessionConfigurationWidget.h
index 239a838..81e8108 100644
--- a/src/modes/xsession/xsessionConfigurationWidget.h
+++ b/src/modes/xsession/xsessionConfigurationWidget.h
@@ -52,29 +52,15 @@ public:
i18n("X Session Log"))
{
setupUi(this);
- /*
- QVBoxLayout* layout = new QVBoxLayout();
- this->setLayout(layout);
+ warningBox = new KMessageWidget(this);
+ warningBox->setVisible(false);
+ warningBox->setMessageType(KMessageWidget::Warning);
+ warningBox->setText(i18n("Log file is missing. Mode will be unavailable."));
+ warningBox->setCloseButtonVisible(false);
+ warningBox->setIcon(QIcon::fromTheme(QLatin1String("dialog-warning")));
- //Authentication log file
- QGroupBox* xsessionBox=new QGroupBox(i18n("X Session Log File"));
- QGridLayout* xsessionLayout = new QGridLayout();
- xsessionBox->setLayout(xsessionLayout);
-
- layout->addWidget(xsessionBox);
-
- xsessionLayout->addWidget(new QLabel(i18n("Log file:")), 0, 0);
-
- xsessionUrlRequester=new KUrlRequester(xsessionBox);
-
- xsessionLayout->addWidget(xsessionUrlRequester, 0, 1);
-
- ignoreXorgErrors = new QCheckBox(i18n("Ignore Xorg Errors"), this);
- xsessionLayout->addWidget(xsessionUrlRequester, 1, 0, 1, 2);
-
- layout->addStretch();
- */
+ verticalLayout->insertWidget(0, warningBox);
xsessionUrlRequester->setToolTip(
i18n("You can type or choose the X Session log file (example: <i>~/.xsession-errors</i>)."));
@@ -113,7 +99,11 @@ public slots:
.findLogMode(QLatin1String(X_SESSION_LOG_MODE_ID))
->logModeConfiguration<XSessionConfiguration *>();
- xsessionUrlRequester->setUrl(QUrl::fromLocalFile(configuration->xsessionPath()));
+ QString path = configuration->xsessionPath();
+ QFileInfo fileInfo(path);
+ warningBox->setVisible(!fileInfo.exists());
+
+ xsessionUrlRequester->setUrl(QUrl::fromLocalFile(path));
ignoreXorgErrors->setChecked(configuration->isIgnoreXorgErrors());
prepareXorgErrorsDescription();
@@ -158,6 +148,8 @@ private:
}
bool xorgErrorsDescriptionDefined;
+
+ KMessageWidget *warningBox;
};
#endif // _X_SESSION_CONFIGURATION_WIDGET_H_
diff --git a/src/modes/xsession/xsessionConfigurationWidgetBase.ui b/src/modes/xsession/xsessionConfigurationWidgetBase.ui
index e6e0500..29577f2 100644
--- a/src/modes/xsession/xsessionConfigurationWidgetBase.ui
+++ b/src/modes/xsession/xsessionConfigurationWidgetBase.ui
@@ -1,7 +1,8 @@
-<ui version="4.0" >
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
<class>XSessionConfigurationWidgetBase</class>
- <widget class="QWidget" name="XSessionConfigurationWidgetBase" >
- <property name="geometry" >
+ <widget class="QWidget" name="XSessionConfigurationWidgetBase">
+ <property name="geometry">
<rect>
<x>0</x>
<y>0</y>
@@ -9,55 +10,59 @@
<height>300</height>
</rect>
</property>
- <layout class="QVBoxLayout" >
+ <layout class="QVBoxLayout">
<item>
- <widget class="QGroupBox" name="groupBox" >
- <property name="title" >
+ <widget class="QGroupBox" name="groupBox">
+ <property name="title">
<string>X Session Log File</string>
</property>
- <layout class="QGridLayout" >
- <item row="0" column="0" >
- <widget class="QLabel" name="label" >
- <property name="text" >
- <string>Log file:</string>
- </property>
- <property name="buddy" >
- <cstring>xsessionUrlRequester</cstring>
- </property>
- </widget>
- </item>
- <item row="0" column="1" >
- <widget class="KUrlRequester" native="1" name="xsessionUrlRequester" >
- <property name="enabled" >
- <bool>false</bool>
- </property>
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
- <horstretch>1</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>&amp;Log file:</string>
+ </property>
+ <property name="buddy">
+ <cstring>xsessionUrlRequester</cstring>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="KUrlRequester" name="xsessionUrlRequester">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
- <item row="1" column="0" colspan="2" >
- <widget class="QCheckBox" name="ignoreXorgErrors" >
- <property name="toolTip" >
+ <item>
+ <widget class="QCheckBox" name="ignoreXorgErrors">
+ <property name="toolTip">
<string>Check this option to remove Xorg errors</string>
</property>
- <property name="whatsThis" >
+ <property name="whatsThis">
<string>Check this option to remove Xorg errors</string>
</property>
- <property name="text" >
+ <property name="text">
<string>Ignore Xorg errors</string>
</property>
</widget>
</item>
- <item row="2" column="0" colspan="2" >
- <widget class="QLabel" name="xorgErrorsDescription" >
- <property name="text" >
- <string>&lt;p>&lt;b>Note:&lt;/b> Check this option to remove X.org errors.&lt;/p>&lt;p style="margin-bottom:0px">The following lines will be ignored:&lt;/p></string>
+ <item>
+ <widget class="QLabel" name="xorgErrorsDescription">
+ <property name="text">
+ <string>&lt;p&gt;&lt;b&gt;Note:&lt;/b&gt; Check this option to remove X.org errors.&lt;/p&gt;&lt;p style=&quot;margin-bottom:0px&quot;&gt;The following lines will be ignored:&lt;/p&gt;</string>
</property>
- <property name="wordWrap" >
+ <property name="wordWrap">
<bool>true</bool>
</property>
</widget>
@@ -67,10 +72,10 @@
</item>
<item>
<spacer>
- <property name="orientation" >
+ <property name="orientation">
<enum>Qt::Vertical</enum>
</property>
- <property name="sizeHint" >
+ <property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>31</height>