[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kate] kate/plugins/pate/src: Passive popup for initialisation error and error message on config pag
From:       Joseph Wenninger <jowenn () kde ! org>
Date:       2012-07-03 12:01:53
Message-ID: 20120703120153.A781AA60A6 () git ! kde ! org
[Download RAW message or body]

Git commit 8970cb495980b24d54bc0314050971b370ab942f by Joseph Wenninger.
Committed on 03/07/2012 at 14:01.
Pushed by jowenn into branch 'master'.

Passive popup for initialisation error and error message on config page, no more \
KMessageBox

M  +68   -53   kate/plugins/pate/src/manager.ui
M  +16   -4    kate/plugins/pate/src/plugin.cpp

http://commits.kde.org/kate/8970cb495980b24d54bc0314050971b370ab942f

diff --git a/kate/plugins/pate/src/manager.ui b/kate/plugins/pate/src/manager.ui
index 4972b68..c8010c5 100644
--- a/kate/plugins/pate/src/manager.ui
+++ b/kate/plugins/pate/src/manager.ui
@@ -6,61 +6,76 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>488</width>
-    <height>388</height>
+    <width>655</width>
+    <height>450</height>
    </rect>
   </property>
-  <widget class="KTabWidget" name="tabWidget">
-   <property name="geometry">
-    <rect>
-     <x>0</x>
-     <y>0</y>
-     <width>400</width>
-     <height>332</height>
-    </rect>
-   </property>
-   <widget class="QWidget" name="manageTab">
-    <attribute name="title">
-     <string>Manage</string>
-    </attribute>
-    <layout class="QVBoxLayout" name="verticalLayout">
-     <item>
-      <widget class="QTreeView" name="tree"/>
-     </item>
-     <item>
-      <widget class="QGroupBox" name="groupBox">
-       <property name="title">
-        <string>Reload Selected Plugins</string>
-       </property>
-       <layout class="QGridLayout" name="gridLayout">
-        <item row="1" column="0">
-         <widget class="QLabel" name="label">
-          <property name="text">
-           <string>Reloading a running plugin may have unpredictable effects. \
Consider saving your work before using this command. Note that other modules will not \
                be reloaded.</string>
-          </property>
-          <property name="wordWrap">
-           <bool>true</bool>
-          </property>
-         </widget>
-        </item>
-        <item row="1" column="1">
-         <widget class="KPushButton" name="reload">
-          <property name="text">
-           <string>Reload</string>
-          </property>
-          <property name="icon">
-           <iconset theme="system-reboot">
-            <normaloff/>
-           </iconset>
-          </property>
-         </widget>
-        </item>
-       </layout>
-      </widget>
-     </item>
-    </layout>
-   </widget>
-  </widget>
+  <layout class="QVBoxLayout" name="verticalLayout_2">
+   <item>
+    <widget class="QLabel" name="errorLabel">
+     <property name="font">
+      <font>
+       <weight>75</weight>
+       <bold>true</bold>
+      </font>
+     </property>
+     <property name="text">
+      <string>ERROR: The Python engine could not be initialised!</string>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="KTabWidget" name="tabWidget">
+     <widget class="QWidget" name="manageTab">
+      <attribute name="title">
+       <string>Manage</string>
+      </attribute>
+      <layout class="QVBoxLayout" name="verticalLayout">
+       <item>
+        <widget class="QTreeView" name="tree"/>
+       </item>
+       <item>
+        <widget class="QGroupBox" name="groupBox">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <property name="title">
+          <string>Reload Selected Plugins</string>
+         </property>
+         <layout class="QGridLayout" name="gridLayout">
+          <item row="1" column="0">
+           <widget class="QLabel" name="label">
+            <property name="text">
+             <string>Reloading a running plugin may have unpredictable effects. \
Consider saving your work before using this command. Note that other modules will not \
be reloaded.</string> +            </property>
+            <property name="wordWrap">
+             <bool>true</bool>
+            </property>
+           </widget>
+          </item>
+          <item row="1" column="1">
+           <widget class="KPushButton" name="reload">
+            <property name="text">
+             <string>Reload</string>
+            </property>
+            <property name="icon">
+             <iconset theme="system-reboot">
+              <normaloff/>
+             </iconset>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </widget>
+       </item>
+      </layout>
+     </widget>
+    </widget>
+   </item>
+  </layout>
  </widget>
  <customwidgets>
   <customwidget>
diff --git a/kate/plugins/pate/src/plugin.cpp b/kate/plugins/pate/src/plugin.cpp
index 828f810..60ce012 100644
--- a/kate/plugins/pate/src/plugin.cpp
+++ b/kate/plugins/pate/src/plugin.cpp
@@ -38,7 +38,7 @@
 #include <KConfigBase>
 #include <KConfigGroup>
 #include <KTextEdit>
-#include <KMessageBox>
+#include <KPassivePopup>
 
 #include <QCheckBox>
 #include <QLabel>
@@ -83,7 +83,7 @@ void Pate::Plugin::readSessionConfig(KConfigBase *config, const \
QString &groupPr  m_autoReload = group.readEntry("AutoReload", false);
     Pate::Engine *engine=Pate::Engine::self();
     if (!engine) {
-      KMessageBox::error(0, i18n("Pate engine could not be initialised"));
+      KPassivePopup::message( i18n("Pate engine could not be \
initialised"),(QWidget*)0);  return;
       
     }
@@ -114,7 +114,7 @@ void Pate::Plugin::reloadModuleConfigPages() const
     m_moduleConfigPages.clear();
     Pate::Engine *engine=Pate::Engine::self();
     if (!engine) {
-      KMessageBox::error(0, i18n("Pate engine could not be initialised"));
+      KPassivePopup::message( i18n("Pate engine could not be \
initialised"),(QWidget*)0);  return;
       
     }
@@ -259,8 +259,9 @@ Pate::ConfigPage::ConfigPage(QWidget *parent, Plugin *plugin) :
 {
     kDebug() << "create ConfigPage";
 
+    
     // Create a page with just the main manager tab.
-    m_manager.setupUi(parent);
+    m_manager.setupUi(this);
     m_manager.tree->setModel(Pate::Engine::self());
     reset();
     connect(m_manager.reload, SIGNAL(clicked(bool)), SLOT(reloadPage(bool)));
@@ -271,6 +272,17 @@ Pate::ConfigPage::ConfigPage(QWidget *parent, Plugin *plugin) :
     m_manager.tabWidget->addTab(infoWidget, i18n("Modules"));
     connect(m_info.topics, SIGNAL(currentIndexChanged(int)), \
SLOT(infoTopicChanged(int)));  reloadPage(true);
+    
+    Pate::Engine *engine=Pate::Engine::self();
+    if (engine) {
+      m_manager.errorLabel->setVisible(false);
+      m_manager.tabWidget->setEnabled(true);
+      m_manager.reload->setEnabled(true);
+    } else {
+      m_manager.errorLabel->setVisible(true);
+      m_manager.tabWidget->setEnabled(false);
+      m_manager.reload->setEnabled(false);
+    }
 }
 
 Pate::ConfigPage::~ConfigPage()


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic