From 63834823c4fb702fd854a25003017fc9ec1c4147 Mon Sep 17 00:00:00 2001
From: Claudio Valerio <claudio@open-sankore.org>
Date: Mon, 27 May 2013 10:11:31 +0200
Subject: [PATCH] removed planete sankore export related gui

---
 resources/forms/preferences.ui                | 93 +------------------
 src/adaptors/publishing/UBDocumentPublisher.h |  2 -
 src/core/UBPreferencesController.cpp          | 80 +---------------
 src/core/UBPreferencesController.h            |  7 +-
 4 files changed, 3 insertions(+), 179 deletions(-)

diff --git a/resources/forms/preferences.ui b/resources/forms/preferences.ui
index 942f7bfa..33465d5d 100644
--- a/resources/forms/preferences.ui
+++ b/resources/forms/preferences.ui
@@ -24,7 +24,7 @@
    <item row="1" column="0">
     <widget class="QTabWidget" name="mainTabWidget">
      <property name="currentIndex">
-      <number>5</number>
+      <number>3</number>
      </property>
      <widget class="QWidget" name="displayTab">
       <attribute name="title">
@@ -609,97 +609,6 @@
         </widget>
        </item>
        <item row="2" column="0">
-        <widget class="QGroupBox" name="CommunityGroupBox">
-         <property name="sizePolicy">
-          <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
-           <horstretch>0</horstretch>
-           <verstretch>0</verstretch>
-          </sizepolicy>
-         </property>
-         <property name="title">
-          <string>Planète Sankoré ID for exporting file</string>
-         </property>
-         <layout class="QGridLayout" name="gridLayout_18">
-          <item row="2" column="1">
-           <layout class="QGridLayout" name="gridLayout_20">
-            <item row="0" column="0">
-             <widget class="QLabel" name="label_4">
-              <property name="text">
-               <string>User:</string>
-              </property>
-             </widget>
-            </item>
-            <item row="0" column="1">
-             <widget class="QWidget" name="widget_3" native="true">
-              <layout class="QHBoxLayout" name="horizontalLayout_11">
-               <property name="spacing">
-                <number>5</number>
-               </property>
-               <property name="margin">
-                <number>0</number>
-               </property>
-               <item>
-                <widget class="QLineEdit" name="Username_textBox">
-                 <property name="echoMode">
-                  <enum>QLineEdit::Normal</enum>
-                 </property>
-                </widget>
-               </item>
-               <item>
-                <widget class="QLabel" name="label_5">
-                 <property name="text">
-                  <string>Pass: </string>
-                 </property>
-                </widget>
-               </item>
-               <item>
-                <widget class="QLineEdit" name="Password_textEdit">
-                 <property name="echoMode">
-                  <enum>QLineEdit::Password</enum>
-                 </property>
-                </widget>
-               </item>
-              </layout>
-             </widget>
-            </item>
-           </layout>
-          </item>
-          <item row="2" column="0">
-           <spacer name="CommunityLSpacer">
-            <property name="orientation">
-             <enum>Qt::Horizontal</enum>
-            </property>
-            <property name="sizeType">
-             <enum>QSizePolicy::Preferred</enum>
-            </property>
-            <property name="sizeHint" stdset="0">
-             <size>
-              <width>40</width>
-              <height>20</height>
-             </size>
-            </property>
-           </spacer>
-          </item>
-          <item row="3" column="1">
-           <widget class="QCheckBox" name="PSCredentialsPersistenceCheckBox">
-            <property name="sizePolicy">
-             <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
-              <horstretch>0</horstretch>
-              <verstretch>0</verstretch>
-             </sizepolicy>
-            </property>
-            <property name="text">
-             <string>Restore credentials on reboot  </string>
-            </property>
-            <property name="checked">
-             <bool>true</bool>
-            </property>
-           </widget>
-          </item>
-         </layout>
-        </widget>
-       </item>
-       <item row="3" column="0">
         <spacer name="verticalSpacer_2">
          <property name="orientation">
           <enum>Qt::Vertical</enum>
diff --git a/src/adaptors/publishing/UBDocumentPublisher.h b/src/adaptors/publishing/UBDocumentPublisher.h
index ed6c7bec..fbcb128a 100644
--- a/src/adaptors/publishing/UBDocumentPublisher.h
+++ b/src/adaptors/publishing/UBDocumentPublisher.h
@@ -27,8 +27,6 @@
 #include <QtGui>
 #include <QtNetwork>
 
-//#define DOCPUBLICATION_URL     "http://planete.sankore.org/xwiki/bin/view/CreateResources/UniboardUpload?xpage=plain&outputSyntax=plain"
-
 typedef struct
 {
     QString title;
diff --git a/src/core/UBPreferencesController.cpp b/src/core/UBPreferencesController.cpp
index b10e85cc..444f843b 100644
--- a/src/core/UBPreferencesController.cpp
+++ b/src/core/UBPreferencesController.cpp
@@ -57,10 +57,7 @@ UBPreferencesDialog::~UBPreferencesDialog()
 
 void UBPreferencesDialog::closeEvent(QCloseEvent* e)
 {
-    if(mPreferencesController->inputValuesConsistence())
-        e->accept();
-    else
-        e->ignore();
+    e->accept();
 }
 
 
@@ -132,8 +129,6 @@ void UBPreferencesController::wire()
 
     connect(mPreferencesUI->useExternalBrowserCheckBox, SIGNAL(clicked(bool)), settings->webUseExternalBrowser, SLOT(setBool(bool)));
     connect(mPreferencesUI->displayBrowserPageCheckBox, SIGNAL(clicked(bool)), settings->webShowPageImmediatelyOnMirroredScreen, SLOT(setBool(bool)));
-    connect(mPreferencesUI->swapControlAndDisplayScreensCheckBox, SIGNAL(clicked(bool)), settings->swapControlAndDisplayScreens, SLOT(setBool(bool)));
-    connect(mPreferencesUI->swapControlAndDisplayScreensCheckBox, SIGNAL(clicked(bool)), UBApplication::applicationController->displayManager(), SLOT(reinitScreens(bool)));
 
     connect(mPreferencesUI->toolbarAtTopRadioButton, SIGNAL(clicked(bool)), this, SLOT(toolbarPositionChanged(bool)));
     connect(mPreferencesUI->toolbarAtBottomRadioButton, SIGNAL(clicked(bool)), this, SLOT(toolbarPositionChanged(bool)));
@@ -176,12 +171,6 @@ void UBPreferencesController::wire()
     connect(mMarkerProperties->pressureSensitiveCheckBox, SIGNAL(clicked(bool)), settings, SLOT(setMarkerPressureSensitive(bool)));
     connect(mMarkerProperties->opacitySlider, SIGNAL(valueChanged(int)), this, SLOT(opacitySliderChanged(int)));
 
-
-    //network
-    connect(mPreferencesUI->Username_textBox, SIGNAL(editingFinished()), this, SLOT(onCommunityUsernameChanged()));
-    connect(mPreferencesUI->Password_textEdit, SIGNAL(editingFinished()), this, SLOT(onCommunityPasswordChanged()));
-    connect(mPreferencesUI->PSCredentialsPersistenceCheckBox,SIGNAL(clicked()),this, SLOT(onCommunityPersistenceChanged()));
-
     // about tab
     connect(mPreferencesUI->checkSoftwareUpdateAtLaunchCheckBox, SIGNAL(clicked(bool)), settings->appEnableAutomaticSoftwareUpdates, SLOT(setBool(bool)));
 }
@@ -215,10 +204,6 @@ void UBPreferencesController::init()
     mPreferencesUI->verticalChoice->setChecked(settings->appToolBarOrientationVertical->get().toBool());
     mPreferencesUI->horizontalChoice->setChecked(!settings->appToolBarOrientationVertical->get().toBool());
 
-    mPreferencesUI->Username_textBox->setText(settings->communityUsername());
-    mPreferencesUI->Password_textEdit->setText(settings->communityPassword());
-    mPreferencesUI->swapControlAndDisplayScreensCheckBox->setChecked(settings->swapControlAndDisplayScreens->get().toBool());
-
     // pen tab
     mPenProperties->fineSlider->setValue(settings->boardPenFineWidth->get().toDouble() * sSliderRatio);
     mPenProperties->mediumSlider->setValue(settings->boardPenMediumWidth->get().toDouble() * sSliderRatio);
@@ -233,66 +218,6 @@ void UBPreferencesController::init()
 
     mMarkerProperties->opacitySlider->setValue(settings->boardMarkerAlpha->get().toDouble() * 100);
 
-    //network
-    mPreferencesUI->PSCredentialsPersistenceCheckBox->setChecked(settings->getCommunityDataPersistence());
-    persistanceCheckboxUpdate();
-
-}
-
-void UBPreferencesController::onCommunityUsernameChanged()
-{
-    UBSettings* settings = UBSettings::settings();
-    settings->setCommunityUsername(mPreferencesUI->Username_textBox->text());
-    persistanceCheckboxUpdate();
-}
-
-void UBPreferencesController::onCommunityPasswordChanged()
-{
-    UBSettings* settings = UBSettings::settings();
-    settings->setCommunityPassword(mPreferencesUI->Password_textEdit->text());
-    persistanceCheckboxUpdate();
-}
-
-void UBPreferencesController::onCommunityPersistenceChanged()
-{
-    UBSettings::settings()->setCommunityPersistence(mPreferencesUI->PSCredentialsPersistenceCheckBox->isChecked());
-}
-
-void UBPreferencesController::persistanceCheckboxUpdate()
-{
-    bool checkBoxEnabled = mPreferencesUI->Username_textBox->text().length() || mPreferencesUI->Password_textEdit->text().length();
-    mPreferencesUI->PSCredentialsPersistenceCheckBox->setEnabled(checkBoxEnabled);
-    mPreferencesUI->PSCredentialsPersistenceCheckBox->setStyleSheet(checkBoxEnabled ? "color:black;" : "color:lightgray;");
-}
-
-
-bool UBPreferencesController::inputValuesConsistence()
-{
-    QString backgroundStyle = "QWidget {background-color: white}";
-    mPreferencesUI->Username_textBox->setStyleSheet(backgroundStyle);
-    mPreferencesUI->Password_textEdit->setStyleSheet(backgroundStyle);
-
-    QString username = mPreferencesUI->Username_textBox->text();
-    QString password = mPreferencesUI->Password_textEdit->text();
-    bool isConsistent = true;
-    if (username.length() + password.length()){
-        backgroundStyle = "QWidget {background-color: magenta}";
-        if(username.isEmpty()){
-            isConsistent = false;
-            mPreferencesUI->mainTabWidget->setCurrentWidget(mPreferencesUI->networkTab);
-            mPreferencesUI->Username_textBox->setStyleSheet(backgroundStyle);
-            mPreferencesUI->Username_textBox->setFocus();
-            mPreferencesUI->Username_textBox->setCursorPosition(0);
-        }
-        else if(password.isEmpty()){
-            isConsistent = false;
-            mPreferencesUI->mainTabWidget->setCurrentWidget(mPreferencesUI->networkTab);
-            mPreferencesUI->Password_textEdit->setStyleSheet(backgroundStyle);
-            mPreferencesUI->Password_textEdit->setFocus();
-            mPreferencesUI->Password_textEdit->setCursorPosition(0);
-        }
-    }
-    return isConsistent;
 }
 
 void UBPreferencesController::close()
@@ -304,9 +229,6 @@ void UBPreferencesController::close()
     UBSettings::settings()->setProxyUsername(mPreferencesUI->proxyUsername->text());
     UBSettings::settings()->setProxyPassword(mPreferencesUI->proxyPassword->text());
 
-    if (!inputValuesConsistence())
-        return;
-
     mPreferencesWindow->accept();
 }
 
diff --git a/src/core/UBPreferencesController.h b/src/core/UBPreferencesController.h
index 3ba0ae96..3827f4ba 100644
--- a/src/core/UBPreferencesController.h
+++ b/src/core/UBPreferencesController.h
@@ -57,13 +57,12 @@ protected:
 
 class UBPreferencesController : public QObject
 {
-    Q_OBJECT;
+    Q_OBJECT
 
     public:
         UBPreferencesController(QWidget *parent);
         virtual ~UBPreferencesController();
 
-        bool inputValuesConsistence();
 
     public slots:
 
@@ -89,9 +88,6 @@ class UBPreferencesController : public QObject
         void toolbarPositionChanged(bool checked);
         void toolbarOrientationVertical(bool checked);
         void toolbarOrientationHorizontal(bool checked);
-        void onCommunityUsernameChanged();
-        void onCommunityPasswordChanged();
-        void onCommunityPersistenceChanged();
 
     private slots:
         void adjustScreens(int screen);
@@ -100,7 +96,6 @@ class UBPreferencesController : public QObject
         static qreal sSliderRatio;
         static qreal sMinPenWidth;
         static qreal sMaxPenWidth;
-        void persistanceCheckboxUpdate();
         QDesktopWidget* mDesktop;
 
 };