[X2go-Commits] x2goclient2.git - master (branch) updated: 94ab8224f72c17665780a906647669403cf82cd5

X2Go dev team git-admin at x2go.org
Tue Oct 23 13:46:56 CEST 2012


The branch, master has been updated
       via  94ab8224f72c17665780a906647669403cf82cd5 (commit)
      from  a873f51840267b6fd474cf6fbd6372e9ebee1e8d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 94ab8224f72c17665780a906647669403cf82cd5
Author: Oleksandr Shneyder <o.shneyder at phoca-gmbh.de>
Date:   Tue Oct 23 13:46:34 2012 +0200

    add class ConfiguratorSharing

-----------------------------------------------------------------------

Summary of changes:
 configuratorprinting.h                        |    2 +-
 configuratorsharing.cpp                       |  173 +++++++++++++++++++++++++
 configuratorserver.h => configuratorsharing.h |   22 ++--
 configuratorsharing.ui                        |  155 ++++++++++++++++++----
 profile.cpp                                   |   12 ++
 profile.h                                     |    6 +
 profiledetailconfiguratorform.cpp             |    6 +
 profilesettingsform.cpp                       |    2 +
 x2goclient2.pro                               |    3 +
 9 files changed, 348 insertions(+), 33 deletions(-)
 create mode 100644 configuratorsharing.cpp
 copy configuratorserver.h => configuratorsharing.h (77%)

The diff of changes is:
diff --git a/configuratorprinting.h b/configuratorprinting.h
index 43057ac..4827e42 100644
--- a/configuratorprinting.h
+++ b/configuratorprinting.h
@@ -37,4 +37,4 @@ private:
     virtual void apply();
 };
 
-#endif // CONFIGURATORSOUND_H
+#endif // CONFIGURATORPRINTING_H
diff --git a/configuratorsharing.cpp b/configuratorsharing.cpp
new file mode 100644
index 0000000..b2cff8a
--- /dev/null
+++ b/configuratorsharing.cpp
@@ -0,0 +1,173 @@
+/**************************************************************************
+*   Copyright (C) 2005-2012 by Oleksandr Shneyder                         *
+*   o.shneyder at phoca-gmbh.de                                              *
+*                                                                         *
+*   This program is free software; you can redistribute it and/or modify  *
+*   it under the terms of the GNU General Public License as published by  *
+*   the Free Software Foundation; either version 2 of the License, or     *
+*   (at your option) any later version.                                   *
+*                                                                         *
+*   This program is distributed in the hope that it will be useful,       *
+*   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
+*   GNU General Public License for more details.                          *
+*                                                                         *
+*   You should have received a copy of the GNU General Public License     *
+*   along with this program; if not, write to the                         *
+*   Free Software Foundation, Inc.,                                       *
+*   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+***************************************************************************/
+
+#include "configuratorsharing.h"
+#include "profile.h"
+#include <QFile>
+#include <QTextStream>
+#include <QFileDialog>
+#include <QStandardItemModel>
+#include <QDebug>
+
+ConfiguratorSharing::ConfiguratorSharing(Profile* profile, QWidget* parent, Qt::WindowFlags f): ProfileDetailConfigurator(profile, parent, f)
+{
+    setupUi(this);
+    loadEncodings(cbLocal);
+    loadEncodings(cbRemote);
+    QStandardItemModel* model=new QStandardItemModel ( 0,2 );
+    model->setHeaderData ( 0,Qt::Horizontal,QVariant (
+                               ( QString ) tr ( "Path" ) ) );
+    model->setHeaderData ( 1,Qt::Horizontal,QVariant (
+                               ( QString ) tr ( "Automount" ) ) );
+    treeView->setModel(( QAbstractItemModel* ) model);
+    treeView->setEditTriggers ( QAbstractItemView::NoEditTriggers );
+    init();
+    connect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SIGNAL(signalModified()));
+}
+
+ConfiguratorSharing::~ConfiguratorSharing()
+{
+
+}
+
+void ConfiguratorSharing::apply()
+{
+    profile->setEncodeFS(cbEncoding->isChecked());
+    profile->setExportFSTunnel(cbTunnel->isChecked());
+    profile->setLocalFSEncoding(cbLocal->currentText());
+    profile->setRemoteFSEncoding(cbRemote->currentText());
+    QString exportDirs;
+    QStandardItemModel* model=(QStandardItemModel*)treeView->model();
+    for ( int i=0; i<model->rowCount(); ++i )
+    {
+#ifndef Q_OS_WIN
+        exportDirs+=model->index ( i,0 ).data().toString() +":";
+#else
+        exportDirs+=model->index ( i,0 ).data().toString() +"#";
+#endif
+
+        if ( model->item ( i,1 )->checkState() ==Qt::Checked )
+            exportDirs+="1;";
+        else
+            exportDirs+="0;";
+    }
+    profile->setExportFolders(exportDirs);
+    ProfileDetailConfigurator::apply();
+}
+
+void ConfiguratorSharing::init()
+{
+    cbEncoding->setChecked(profile->getEncodeFS());
+    cbTunnel->setChecked(profile->getExportFSTunnel());
+    cbLocal->setCurrentIndex(cbLocal->findText(profile->getLocalFSEncoding()));
+    cbRemote->setCurrentIndex(cbRemote->findText(profile->getRemoteFSEncoding()));
+    QStringList lst=profile->getExportFolders().split ( ";",QString::SkipEmptyParts );
+    QStandardItemModel* model=(QStandardItemModel*)treeView->model();
+    model->removeRows(0, model->rowCount());
+    for ( int i=0; i<lst.size(); ++i )
+    {
+#ifndef Q_OS_WIN
+        QStringList tails=lst[i].split ( ":",QString::SkipEmptyParts );
+#else
+        QStringList tails=lst[i].split ( "#",QString::SkipEmptyParts );
+#endif
+        QStandardItem *item;
+        item= new QStandardItem ( tails[0] );
+        model->setItem ( model->rowCount(),0,item );
+        item= new QStandardItem();
+        item->setCheckable ( true );
+        if ( tails[1]=="1" )
+            item->setCheckState ( Qt::Checked );
+        model->setItem ( model->rowCount()-1,1,item );
+    }
+    treeView->resizeColumnToContents(0);
+}
+
+void ConfiguratorSharing::defaults()
+{
+    cbEncoding->setChecked(false);
+    cbTunnel->setChecked(true);
+    cbLocal->setCurrentIndex(cbLocal->findText(profile->getLocalFSEncoding()));
+    cbRemote->setCurrentIndex(cbRemote->findText("UTF-8"));
+#ifdef Q_OS_WIN
+    cbLocal->setCurrentIndex(cbLocal->findText("WINDOWS-1252"));
+#endif
+#ifdef Q_OS_DARWIN
+    cbLocal->setCurrentIndex(cbLocal->findText("UTF-8"));
+#endif
+#ifdef Q_OS_LINUX
+    cbLocal->setCurrentIndex(cbLocal->findText("ISO8859-1"));
+#endif
+    ProfileDetailConfigurator::defaults();
+}
+
+void ConfiguratorSharing::loadEncodings(QComboBox* box)
+{
+    QFile file ( ":/txt/encodings" );
+    if ( !file.open ( QIODevice::ReadOnly | QIODevice::Text ) )
+        return;
+    QTextStream in ( &file );
+    while ( !in.atEnd() )
+    {
+        QString line = in.readLine();
+        line=line.replace ( "//","" );
+        box->addItem ( line );
+    }
+}
+
+void ConfiguratorSharing::slotFindPath()
+{
+    QString startDir=QDir::homePath();
+
+    QString path= QFileDialog::getExistingDirectory (
+                      this,
+                      tr ( "Select folder" ),
+                      startDir );
+    if ( path!=QString::null )
+    {
+        lePath->setText ( path );
+    }
+
+}
+
+void ConfiguratorSharing::slotAddShare()
+{
+    QString path=lePath->text();
+    if ( path.length() <1 )
+        return;
+    QStandardItemModel* model=(QStandardItemModel*)treeView->model();
+    for ( int i=0; i<model->rowCount(); ++i )
+        if ( model->index ( i,0 ).data().toString() ==path )
+            return;
+    QStandardItem *item;
+    item= new QStandardItem ( path );
+    model->setItem ( model->rowCount(),0,item );
+    item= new QStandardItem();
+    item->setCheckable ( true );
+    model->setItem ( model->rowCount()-1,1,item );
+    lePath->setText ( QString::null );
+    treeView->resizeColumnToContents(0);
+}
+
+void ConfiguratorSharing::slotRemoveShare()
+{
+    QStandardItemModel* model=(QStandardItemModel*)treeView->model();
+    model->removeRow ( treeView->currentIndex().row() );
+}
diff --git a/configuratorserver.h b/configuratorsharing.h
similarity index 77%
copy from configuratorserver.h
copy to configuratorsharing.h
index 9826d80..062f08f 100644
--- a/configuratorserver.h
+++ b/configuratorsharing.h
@@ -19,25 +19,27 @@
 ***************************************************************************/
 
 
-#ifndef CONFIGURATORSERVER_H
-#define CONFIGURATORSERVER_H
+#ifndef CONFIGURATORSHARING_H
+#define CONFIGURATORSHARING_H
 
-#include "ui_configuratorserver.h"
 #include "profiledetailconfigurator.h"
+#include "ui_configuratorsharing.h"
 
-class ConfiguratorServer:public ProfileDetailConfigurator, public Ui_ConfiguratorServer
+class ConfiguratorSharing: public ProfileDetailConfigurator, public Ui_ConfiguratorSharing
 {
     Q_OBJECT
 public:
-    ConfiguratorServer(Profile* profile, QWidget* parent = 0, Qt::WindowFlags f = 0);
-    virtual ~ConfiguratorServer();
+    ConfiguratorSharing(Profile* profile, QWidget* parent = 0, Qt::WindowFlags f = 0);
+    virtual ~ConfiguratorSharing();
 private:
     virtual void init();
-    virtual void apply();
     virtual void defaults();
+    virtual void apply();
+    void loadEncodings(QComboBox* box);
 private slots:
-    void slotGetKey();
-    void slotGetProxyKey();
+    void slotFindPath();
+    void slotAddShare();
+    void slotRemoveShare();
 };
 
-#endif // CONFIGURATORSERVER_H
+#endif // CONFIGURATORSHARING_H
diff --git a/configuratorsharing.ui b/configuratorsharing.ui
index aabab0b..743c4e1 100644
--- a/configuratorsharing.ui
+++ b/configuratorsharing.ui
@@ -32,7 +32,7 @@
         </widget>
        </item>
        <item>
-        <widget class="QLineEdit" name="lineEdit">
+        <widget class="QLineEdit" name="lePath">
          <property name="readOnly">
           <bool>true</bool>
          </property>
@@ -66,17 +66,10 @@
       </widget>
      </item>
      <item row="1" column="0">
-      <widget class="QTreeWidget" name="treeWidget">
-       <column>
-        <property name="text">
-         <string>Path</string>
-        </property>
-       </column>
-       <column>
-        <property name="text">
-         <string>Automount</string>
-        </property>
-       </column>
+      <widget class="QTreeView" name="treeView">
+       <property name="rootIsDecorated">
+        <bool>false</bool>
+       </property>
       </widget>
      </item>
     </layout>
@@ -84,7 +77,7 @@
    <item>
     <layout class="QHBoxLayout" name="horizontalLayout">
      <item>
-      <widget class="QCheckBox" name="checkBox_2">
+      <widget class="QCheckBox" name="cbEncoding">
        <property name="text">
         <string>Filename encoding</string>
        </property>
@@ -101,7 +94,7 @@
       </widget>
      </item>
      <item>
-      <widget class="QComboBox" name="comboBox">
+      <widget class="QComboBox" name="cbLocal">
        <property name="enabled">
         <bool>false</bool>
        </property>
@@ -118,7 +111,7 @@
       </widget>
      </item>
      <item>
-      <widget class="QComboBox" name="comboBox_2">
+      <widget class="QComboBox" name="cbRemote">
        <property name="enabled">
         <bool>false</bool>
        </property>
@@ -140,7 +133,7 @@
     </layout>
    </item>
    <item>
-    <widget class="QCheckBox" name="checkBox">
+    <widget class="QCheckBox" name="cbTunnel">
      <property name="text">
       <string>Use ssh port forwarding to tunnel file system connections through firewalls</string>
      </property>
@@ -153,9 +146,9 @@
  </resources>
  <connections>
   <connection>
-   <sender>checkBox_2</sender>
+   <sender>cbEncoding</sender>
    <signal>toggled(bool)</signal>
-   <receiver>comboBox</receiver>
+   <receiver>cbLocal</receiver>
    <slot>setEnabled(bool)</slot>
    <hints>
     <hint type="sourcelabel">
@@ -169,7 +162,7 @@
    </hints>
   </connection>
   <connection>
-   <sender>checkBox_2</sender>
+   <sender>cbEncoding</sender>
    <signal>toggled(bool)</signal>
    <receiver>label</receiver>
    <slot>setEnabled(bool)</slot>
@@ -185,7 +178,7 @@
    </hints>
   </connection>
   <connection>
-   <sender>checkBox_2</sender>
+   <sender>cbEncoding</sender>
    <signal>toggled(bool)</signal>
    <receiver>label_2</receiver>
    <slot>setEnabled(bool)</slot>
@@ -201,9 +194,9 @@
    </hints>
   </connection>
   <connection>
-   <sender>checkBox_2</sender>
+   <sender>cbEncoding</sender>
    <signal>toggled(bool)</signal>
-   <receiver>comboBox_2</receiver>
+   <receiver>cbRemote</receiver>
    <slot>setEnabled(bool)</slot>
    <hints>
     <hint type="sourcelabel">
@@ -216,5 +209,123 @@
     </hint>
    </hints>
   </connection>
+  <connection>
+   <sender>cbEncoding</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>ConfiguratorSharing</receiver>
+   <slot>slotEmitModified()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>47</x>
+     <y>346</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>634</x>
+     <y>333</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>cbTunnel</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>ConfiguratorSharing</receiver>
+   <slot>slotEmitModified()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>276</x>
+     <y>378</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>695</x>
+     <y>361</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>cbRemote</sender>
+   <signal>currentIndexChanged(QString)</signal>
+   <receiver>ConfiguratorSharing</receiver>
+   <slot>slotEmitModified()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>479</x>
+     <y>355</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>585</x>
+     <y>337</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>cbLocal</sender>
+   <signal>currentIndexChanged(QString)</signal>
+   <receiver>ConfiguratorSharing</receiver>
+   <slot>slotEmitModified()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>249</x>
+     <y>349</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>644</x>
+     <y>276</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>pushButton</sender>
+   <signal>clicked()</signal>
+   <receiver>ConfiguratorSharing</receiver>
+   <slot>slotFindPath()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>595</x>
+     <y>25</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>650</x>
+     <y>113</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>pushButton_2</sender>
+   <signal>clicked()</signal>
+   <receiver>ConfiguratorSharing</receiver>
+   <slot>slotAddShare()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>660</x>
+     <y>21</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>650</x>
+     <y>62</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>pushButton_3</sender>
+   <signal>clicked()</signal>
+   <receiver>ConfiguratorSharing</receiver>
+   <slot>slotRemoveShare()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>664</x>
+     <y>189</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>640</x>
+     <y>220</y>
+    </hint>
+   </hints>
+  </connection>
  </connections>
+ <slots>
+  <slot>slotEmitModified()</slot>
+  <slot>slotFindPath()</slot>
+  <slot>slotAddShare()</slot>
+  <slot>slotRemoveShare()</slot>
+ </slots>
 </ui>
diff --git a/profile.cpp b/profile.cpp
index a8fb5f0..a63c6e7 100644
--- a/profile.cpp
+++ b/profile.cpp
@@ -67,6 +67,18 @@ Profile::Profile(QWidget* parent, Qt::WindowFlags f): QFrame(parent, f)
     soundPort=4713;
     useDefaultSoundPort=true;
     printing=true;
+    exportFSTunnel=true;
+    encodeFS=false;
+    remoteFSEncoding="UTF-8";
+#ifdef Q_OS_WIN
+    localFSEncoding=tr ( "WINDOWS-1252" );
+#endif
+#ifdef Q_OS_DARWIN
+    localFSEncoding="UTF-8";
+#endif
+#ifdef Q_OS_LINUX
+    localFSEncoding=tr ( "ISO8859-1" );
+#endif
 //
     inited=false;
     selected=false;
diff --git a/profile.h b/profile.h
index 68ceb0c..464bf6d 100644
--- a/profile.h
+++ b/profile.h
@@ -86,6 +86,12 @@ public:
     X2GO_PROPERTY(int, soundPort, setSoundPort, getSoundPort)
 
     X2GO_PROPERTY(bool, printing, setPrinting, getPrinting)
+
+    X2GO_PROPERTY(QString, exportFolders, setExportFolders, getExportFolders)
+    X2GO_PROPERTY(bool, exportFSTunnel, setExportFSTunnel, getExportFSTunnel)
+    X2GO_PROPERTY(bool, encodeFS, setEncodeFS, getEncodeFS)
+    X2GO_PROPERTY(QString, localFSEncoding, setLocalFSEncoding, getLocalFSEncoding)
+    X2GO_PROPERTY(QString, remoteFSEncoding, setRemoteFSEncoding, getRemoteFSEncoding)
 public:
     Profile(QWidget* parent = 0, Qt::WindowFlags f = 0);
     virtual ~Profile();
diff --git a/profiledetailconfiguratorform.cpp b/profiledetailconfiguratorform.cpp
index 3bceefc..41f27b9 100644
--- a/profiledetailconfiguratorform.cpp
+++ b/profiledetailconfiguratorform.cpp
@@ -31,6 +31,7 @@
 #include "configuratorkeyboard.h"
 #include "configuratorsound.h"
 #include "configuratorprinting.h"
+#include "configuratorsharing.h"
 #include "profileform.h"
 #include "profilesettingsform.h"
 #include "sessionform.h"
@@ -162,6 +163,11 @@ void ProfileDetailConfiguratorForm::setConfigurator(Profile* profile, ProfileDet
         profileDetailConfigurator=new ConfiguratorPrinting(profile, scrollArea);
         break;
     }
+    case FOLDERS:
+    {
+        profileDetailConfigurator=new ConfiguratorSharing(profile, scrollArea);
+        break;
+    }
     default:
         return;
     }
diff --git a/profilesettingsform.cpp b/profilesettingsform.cpp
index 5f212d5..9bdc784 100644
--- a/profilesettingsform.cpp
+++ b/profilesettingsform.cpp
@@ -146,6 +146,8 @@ void ProfileSettingsForm::slotItemActivated(QListWidgetItem* item)
         X2GoApplication::instance()->getProfileDetailConfiguratorForm()->setConfigurator(profile, ProfileDetailConfiguratorForm::SOUND);
     if(item==lwiPrinting)
         X2GoApplication::instance()->getProfileDetailConfiguratorForm()->setConfigurator(profile, ProfileDetailConfiguratorForm::PRINTING);
+    if(item==lwiFolders)
+        X2GoApplication::instance()->getProfileDetailConfiguratorForm()->setConfigurator(profile, ProfileDetailConfiguratorForm::FOLDERS);
     X2GoApplication::instance()->getWorkArea()->slotScrollToProfileDetailConfiguratorForm();
 }
 
diff --git a/x2goclient2.pro b/x2goclient2.pro
index 93782cf..ff99272 100755
--- a/x2goclient2.pro
+++ b/x2goclient2.pro
@@ -24,6 +24,7 @@ FORMS += mainwindow.ui \
          configuratorkeyboard.ui \
          configuratorsound.ui \
          configuratorprinting.ui \
+         configuratorsharing.ui \
          profile.ui
 
 SOURCES += main.cpp \
@@ -46,6 +47,7 @@ SOURCES += main.cpp \
            configuratorkeyboard.cpp \
            configuratorsound.cpp \
            configuratorprinting.cpp \
+           configuratorsharing.cpp \
            profile.cpp
 
 HEADERS += mainwindow.h \
@@ -67,6 +69,7 @@ HEADERS += mainwindow.h \
            configuratorkeyboard.h \
            configuratorsound.h \
            configuratorprinting.h \
+           configuratorsharing.h \
            profile.h
 
 LIBS += -lssh


hooks/post-receive
-- 
x2goclient2.git (X2Go Client 2 (rewrite of x2goclient.git))

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "x2goclient2.git" (X2Go Client 2 (rewrite of x2goclient.git)).




More information about the x2go-commits mailing list