[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: [PATCH] for knetattach to enable encoding selection in its wizard
From: "Wang Hoi Wang" <zealot.hoi () gmail ! com>
Date: 2008-07-23 8:39:57
Message-ID: 2c13fc000807230139g18b02c34qfd3d5aeffaee77ac () mail ! gmail ! com
[Download RAW message or body]
with this patch,
when using dolphin/konqueror to mount remote folder, user can specify
remote encoding in the wizard for ftp & ssh protocol
Index: knetattach.ui
===================================================================
--- knetattach.ui (版本 836001)
+++ knetattach.ui (工作副本)
@@ -1,364 +1,392 @@
-<ui version="4.0" stdsetdef="1" >
- <author></author>
- <comment></comment>
- <exportmacro></exportmacro>
- <class>KNetAttach</class>
- <widget class="Q3Wizard" name="KNetAttach" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>0</y>
- <width>594</width>
- <height>371</height>
- </rect>
+<ui version="4.0" >
+ <class>KNetAttach</class>
+ <widget class="Q3Wizard" name="KNetAttach" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>594</width>
+ <height>431</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Network Folder Wizard</string>
+ </property>
+ <property name="titleFont" >
+ <font>
+ <pointsize>16</pointsize>
+ </font>
+ </property>
+ <widget class="QWidget" name="_folderType" >
+ <property name="geometry" >
+ <rect>
+ <x>6</x>
+ <y>50</y>
+ <width>582</width>
+ <height>331</height>
+ </rect>
+ </property>
+ <attribute name="title" >
+ <string>Add Network Folder</string>
+ </attribute>
+ <layout class="QGridLayout" >
+ <property name="margin" >
+ <number>0</number>
</property>
- <property name="windowTitle" >
- <string>Network Folder Wizard</string>
- </property>
- <property name="titleFont" >
- <font>
- <pointsize>16</pointsize>
- </font>
- </property>
- <widget class="QWidget" name="_folderType" >
- <attribute name="title" >
- <string>Add Network Folder</string>
- </attribute>
+ <item row="2" column="0" >
+ <widget class="KButtonGroup" name="buttonGroup1" >
+ <property name="title" >
+ <string/>
+ </property>
<layout class="QGridLayout" >
- <property name="margin" >
- <number>0</number>
- </property>
- <item row="2" column="0" >
- <widget class="KButtonGroup" name="buttonGroup1" >
- <property name="title" >
- <string/>
- </property>
- <layout class="QGridLayout" >
- <property name="margin" >
- <number>0</number>
- </property>
- <item row="4" column="0" >
- <widget class="QRadioButton" name="_recent" >
- <property name="text" >
- <string>&Recent connection:</string>
- </property>
- </widget>
- </item>
- <item rowspan="1" row="0" column="0" colspan="2" >
- <widget class="QRadioButton" name="_webfolder" >
- <property name="text" >
- <string>&WebFolder (webdav)</string>
- </property>
- <property name="checked" >
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item rowspan="1" row="3" column="0" colspan="2" >
- <widget class="QRadioButton" name="_fish" >
- <property name="text" >
- <string>&Secure shell (ssh)</string>
- </property>
- <property name="checked" >
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="4" column="1" >
- <widget class="KComboBox" name="_recentConnectionName" >
- <property name="enabled" >
- <bool>false</bool>
- </property>
- <property name="sizePolicy" >
- <sizepolicy>
- <hsizetype>1</hsizetype>
- <vsizetype>0</vsizetype>
- <horstretch>1</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize" >
- <size>
- <width>250</width>
- <height>0</height>
- </size>
- </property>
- </widget>
- </item>
- <item rowspan="1" row="1" column="0" colspan="2" >
- <widget class="QRadioButton" name="_ftp" >
- <property name="text" >
- <string>FT&P</string>
- </property>
- </widget>
- </item>
- <item rowspan="1" row="2" column="0" colspan="2" >
- <widget class="QRadioButton" name="_smb" >
- <property name="text" >
- <string>&Microsoft(R) Windows(R) network drive</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item row="3" column="0" >
- <spacer name="spacer2_2" >
- <property name="sizeHint" >
- <size>
- <width>31</width>
- <height>16</height>
- </size>
- </property>
- <property name="sizeType" >
- <enum>Expanding</enum>
- </property>
- <property name="orientation" >
- <enum>Qt::Vertical</enum>
- </property>
- </spacer>
- </item>
- <item row="0" column="0" >
- <widget class="QLabel" name="textLabel1_2" >
- <property name="text" >
- <string>Select the type of network folder you wish to
connect to and press the Next button.</string>
- </property>
- <property name="alignment" >
- <set>Qt::AlignVCenter</set>
- </property>
- <property name="wordWrap" >
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="1" column="0" >
- <spacer name="spacer20" >
- <property name="sizeHint" >
- <size>
- <width>20</width>
- <height>21</height>
- </size>
- </property>
- <property name="sizeType" >
- <enum>Fixed</enum>
- </property>
- <property name="orientation" >
- <enum>Qt::Vertical</enum>
- </property>
- </spacer>
- </item>
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <item row="4" column="0" >
+ <widget class="QRadioButton" name="_recent" >
+ <property name="text" >
+ <string>&Recent connection:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0" colspan="2" >
+ <widget class="QRadioButton" name="_webfolder" >
+ <property name="text" >
+ <string>&WebFolder (webdav)</string>
+ </property>
+ <property name="checked" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0" colspan="2" >
+ <widget class="QRadioButton" name="_fish" >
+ <property name="text" >
+ <string>&Secure shell (ssh)</string>
+ </property>
+ <property name="checked" >
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="1" >
+ <widget class="KComboBox" name="_recentConnectionName" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize" >
+ <size>
+ <width>250</width>
+ <height>0</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" colspan="2" >
+ <widget class="QRadioButton" name="_ftp" >
+ <property name="text" >
+ <string>FT&P</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" colspan="2" >
+ <widget class="QRadioButton" name="_smb" >
+ <property name="text" >
+ <string>&Microsoft(R) Windows(R) network drive</string>
+ </property>
+ </widget>
+ </item>
</layout>
- </widget>
- <widget class="QWidget" name="_folderParameters" >
- <attribute name="title" >
- <string>Network Folder Information</string>
- </attribute>
- <layout class="QGridLayout" >
- <property name="margin" >
- <number>0</number>
- </property>
- <item rowspan="1" row="0" column="0" colspan="3" >
- <widget class="QLabel" name="_informationText" >
- <property name="text" >
- <string>Enter a name for this <i>%1</i> as well
as the server address, port and folder path to use and press the Next
button.</string>
- </property>
- <property name="wordWrap" >
- <bool>true</bool>
- </property>
- <property name="alignment" >
- <set>Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="1" column="2" >
- <spacer name="spacer20_2" >
- <property name="sizeHint" >
- <size>
- <width>20</width>
- <height>21</height>
- </size>
- </property>
- <property name="sizeType" >
- <enum>Fixed</enum>
- </property>
- <property name="orientation" >
- <enum>Qt::Vertical</enum>
- </property>
- </spacer>
- </item>
- <item row="2" column="0" >
- <widget class="QLabel" name="textLabel4_2" >
- <property name="text" >
- <string>&Name:</string>
- </property>
- <property name="buddy" stdset="0" >
- <cstring>_connectionName</cstring>
- </property>
- <property name="wordWrap" >
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item rowspan="1" row="2" column="1" colspan="2" >
- <widget class="KLineEdit" name="_connectionName" />
- </item>
- <item row="5" column="1" >
- <widget class="QSpinBox" name="_port" >
- <property name="sizePolicy" >
- <sizepolicy>
- <hsizetype>1</hsizetype>
- <vsizetype>0</vsizetype>
- <horstretch>1</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="maximum" >
- <number>65535</number>
- </property>
- <property name="minimum" >
- <number>1</number>
- </property>
- </widget>
- </item>
- <item rowspan="1" row="6" column="1" colspan="2" >
- <widget class="KLineEdit" name="_path" />
- </item>
- <item row="3" column="0" >
- <widget class="QLabel" name="_userText" >
- <property name="text" >
- <string>&User:</string>
- </property>
- <property name="buddy" stdset="0" >
- <cstring>_user</cstring>
- </property>
- <property name="wordWrap" >
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="4" column="0" >
- <widget class="QLabel" name="textLabel1" >
- <property name="text" >
- <string>Se&rver:</string>
- </property>
- <property name="buddy" stdset="0" >
- <cstring>_host</cstring>
- </property>
- <property name="wordWrap" >
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="5" column="0" >
- <widget class="QLabel" name="_portText" >
- <property name="text" >
- <string>&Port:</string>
- </property>
- <property name="buddy" stdset="0" >
- <cstring>_port</cstring>
- </property>
- <property name="wordWrap" >
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item rowspan="1" row="3" column="1" colspan="2" >
- <widget class="KLineEdit" name="_user" >
- <property name="sizePolicy" >
- <sizepolicy>
- <hsizetype>7</hsizetype>
- <vsizetype>0</vsizetype>
- <horstretch>10</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
- </item>
- <item rowspan="1" row="4" column="1" colspan="2" >
- <widget class="KLineEdit" name="_host" >
- <property name="sizePolicy" >
- <sizepolicy>
- <hsizetype>7</hsizetype>
- <vsizetype>0</vsizetype>
- <horstretch>10</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
- </item>
- <item row="6" column="0" >
- <widget class="QLabel" name="textLabel3" >
- <property name="text" >
- <string>&Folder:</string>
- </property>
- <property name="buddy" stdset="0" >
- <cstring>_path</cstring>
- </property>
- <property name="wordWrap" >
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item rowspan="1" row="9" column="0" colspan="3" >
- <spacer name="spacer5" >
- <property name="sizeHint" >
- <size>
- <width>560</width>
- <height>16</height>
- </size>
- </property>
- <property name="sizeType" >
- <enum>Expanding</enum>
- </property>
- <property name="orientation" >
- <enum>Qt::Vertical</enum>
- </property>
- </spacer>
- </item>
- <item rowspan="1" row="7" column="1" colspan="2" >
- <widget class="QCheckBox" name="_createIcon" >
- <property name="text" >
- <string>Cr&eate an icon for this remote folder</string>
- </property>
- <property name="checked" >
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item rowspan="1" row="8" column="1" colspan="2" >
- <widget class="QCheckBox" name="_useEncryption" >
- <property name="text" >
- <string>&Use encryption</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
+ </widget>
+ </item>
+ <item row="3" column="0" >
+ <spacer name="spacer2_2" >
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeType" >
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="sizeHint" stdset="0" >
+ <size>
+ <width>31</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="0" column="0" >
+ <widget class="QLabel" name="textLabel1_2" >
+ <property name="text" >
+ <string>Select the type of network folder you wish to connect
to and press the Next button.</string>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignVCenter</set>
+ </property>
+ <property name="wordWrap" >
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <spacer name="spacer20" >
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeType" >
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" stdset="0" >
+ <size>
+ <width>20</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
</widget>
- <layoutdefault spacing="6" margin="11" />
- <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
- <customwidgets>
- <customwidget>
- <class>KComboBox</class>
- <extends>QComboBox</extends>
- <header>kcombobox.h</header>
- </customwidget>
- </customwidgets>
- <tabstops>
- <tabstop>_webfolder</tabstop>
- <tabstop>_recentConnectionName</tabstop>
- <tabstop>_connectionName</tabstop>
- <tabstop>_user</tabstop>
- <tabstop>_host</tabstop>
- <tabstop>_port</tabstop>
- <tabstop>_path</tabstop>
- <tabstop>_createIcon</tabstop>
- <tabstop>_useEncryption</tabstop>
- </tabstops>
- <includes>
- <include location="global" >kurl.h</include>
- <include location="global" >qpushbutton.h</include>
- <include location="global" >kbuttongroup.h</include>
- <include location="global" >ktoolinvocation.h</include>
- </includes>
+ <widget class="QWidget" name="_folderParameters" >
+ <attribute name="title" >
+ <string>Network Folder Information</string>
+ </attribute>
+ <layout class="QGridLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <item row="0" column="0" colspan="3" >
+ <widget class="QLabel" name="_informationText" >
+ <property name="text" >
+ <string>Enter a name for this <i>%1</i> as well as the
server address, port and folder path to use and press the Next
button.</string>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignVCenter</set>
+ </property>
+ <property name="wordWrap" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="2" >
+ <spacer name="spacer20_2" >
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeType" >
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" stdset="0" >
+ <size>
+ <width>20</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="2" column="0" >
+ <widget class="QLabel" name="textLabel4_2" >
+ <property name="text" >
+ <string>&Name:</string>
+ </property>
+ <property name="wordWrap" >
+ <bool>false</bool>
+ </property>
+ <property name="buddy" >
+ <cstring>_connectionName</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="1" >
+ <widget class="QSpinBox" name="_port" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimum" >
+ <number>1</number>
+ </property>
+ <property name="maximum" >
+ <number>65535</number>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="1" colspan="2" >
+ <widget class="KLineEdit" name="_path" />
+ </item>
+ <item row="3" column="0" >
+ <widget class="QLabel" name="_userText" >
+ <property name="text" >
+ <string>&User:</string>
+ </property>
+ <property name="wordWrap" >
+ <bool>false</bool>
+ </property>
+ <property name="buddy" >
+ <cstring>_user</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0" >
+ <widget class="QLabel" name="textLabel1" >
+ <property name="text" >
+ <string>Se&rver:</string>
+ </property>
+ <property name="wordWrap" >
+ <bool>false</bool>
+ </property>
+ <property name="buddy" >
+ <cstring>_host</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="0" >
+ <widget class="QLabel" name="_portText" >
+ <property name="text" >
+ <string>&Port:</string>
+ </property>
+ <property name="wordWrap" >
+ <bool>false</bool>
+ </property>
+ <property name="buddy" >
+ <cstring>_port</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1" colspan="2" >
+ <widget class="KLineEdit" name="_user" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
+ <horstretch>10</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="1" colspan="2" >
+ <widget class="KLineEdit" name="_host" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
+ <horstretch>10</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="0" >
+ <widget class="QLabel" name="textLabel3" >
+ <property name="text" >
+ <string>&Folder:</string>
+ </property>
+ <property name="wordWrap" >
+ <bool>false</bool>
+ </property>
+ <property name="buddy" >
+ <cstring>_path</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="11" column="0" colspan="3" >
+ <spacer name="spacer5" >
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeType" >
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="sizeHint" stdset="0" >
+ <size>
+ <width>560</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="8" column="1" colspan="2" >
+ <widget class="QCheckBox" name="_createIcon" >
+ <property name="text" >
+ <string>Cr&eate an icon for this remote folder</string>
+ </property>
+ <property name="checked" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1" colspan="2" >
+ <widget class="KLineEdit" name="_connectionName" />
+ </item>
+ <item row="9" column="1" >
+ <widget class="QCheckBox" name="_useEncryption" >
+ <property name="text" >
+ <string>&Use encryption</string>
+ </property>
+ </widget>
+ </item>
+ <item row="7" column="0" >
+ <widget class="QLabel" name="_encodingText" >
+ <property name="enabled" >
+ <bool>true</bool>
+ </property>
+ <property name="text" >
+ <string>Encoding:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="7" column="1" >
+ <widget class="KComboBox" name="_encoding" />
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ <layoutdefault spacing="6" margin="11" />
+ <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
+ <customwidgets>
+ <customwidget>
+ <class>Q3Wizard</class>
+ <extends>QDialog</extends>
+ <header>q3wizard.h</header>
+ <container>1</container>
+ </customwidget>
+ <customwidget>
+ <class>KButtonGroup</class>
+ <extends>QGroupBox</extends>
+ <header>kbuttongroup.h</header>
+ <container>1</container>
+ </customwidget>
+ <customwidget>
+ <class>KComboBox</class>
+ <extends>QComboBox</extends>
+ <header>kcombobox.h</header>
+ </customwidget>
+ <customwidget>
+ <class>KLineEdit</class>
+ <extends>QLineEdit</extends>
+ <header>klineedit.h</header>
+ </customwidget>
+ </customwidgets>
+ <tabstops>
+ <tabstop>_webfolder</tabstop>
+ <tabstop>_recentConnectionName</tabstop>
+ <tabstop>_connectionName</tabstop>
+ <tabstop>_user</tabstop>
+ <tabstop>_host</tabstop>
+ <tabstop>_port</tabstop>
+ <tabstop>_path</tabstop>
+ <tabstop>_createIcon</tabstop>
+ </tabstops>
+ <includes>
+ <include location="global" >kurl.h</include>
+ <include location="global" >qpushbutton.h</include>
+ <include location="global" >kbuttongroup.h</include>
+ <include location="global" >ktoolinvocation.h</include>
+ </includes>
+ <resources/>
+ <connections/>
</ui>
Index: knetattach.cpp
===================================================================
--- knetattach.cpp (版本 836001)
+++ knetattach.cpp (工作副本)
@@ -30,6 +30,7 @@
#include <kapplication.h>
#include <kstandarddirs.h>
#include <kdirnotify.h>
+#include <kcharsets.h>
KNetAttach::KNetAttach( QWidget* parent )
: Q3Wizard( parent ), Ui_KNetAttach()
@@ -62,6 +63,9 @@
_recent->setEnabled(true);
_recentConnectionName->addItems(idx);
}
+ _encoding->clear();
+ _encoding->addItems(KGlobal::charsets()->descriptiveEncodingNames());
+ _encoding->setCurrentIndex(0);
}
void KNetAttach::slotHelpClicked()
@@ -179,6 +183,10 @@
} else if (_type == "FTP") {
url.setProtocol("ftp");
url.setPort(_port->value());
+ KConfig config("kio_ftprc");
+ KConfigGroup cg(&config, _host->text().trimmed());
+ cg.writeEntry("Charset",
KGlobal::charsets()->encodingForName(_encoding->currentText()));
+ config.sync();
} else if (_type == "SMB") {
url.setProtocol("smb");
} else { // recent
@@ -219,6 +227,7 @@
desktopFile.writeEntry("Name", name);
desktopFile.writeEntry("Type", "Link");
desktopFile.writeEntry("URL", url.prettyUrl());
+ desktopFile.writeEntry("Charset", url.fileEncoding());
desktopFile.sync();
org::kde::KDirNotify::emitFilesAdded( "remote:/" );
}
@@ -287,6 +296,8 @@
_port->show();
_userText->show();
_user->show();
+ _encodingText->hide();
+ _encoding->hide();
} else if (protocol == "Fish") {
_useEncryption->hide();
_portText->show();
@@ -299,12 +310,16 @@
_port->show();
_userText->show();
_user->show();
+ _encodingText->show();
+ _encoding->show();
} else if (protocol == "SMB") {
_useEncryption->hide();
_portText->hide();
_port->hide();
_userText->hide();
_user->hide();
+ _encodingText->hide();
+ _encoding->hide();
} else {
_type = "";
return false;
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic