summaryrefslogtreecommitdiffstats
path: root/knetattach
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit4aed2c8219774f5d797760606b8489a92ddc5163 (patch)
tree3f8c130f7d269626bf6a9447407ef6c35954426a /knetattach
downloadtdebase-4aed2c8219774f5d797760606b8489a92ddc5163.tar.gz
tdebase-4aed2c8219774f5d797760606b8489a92ddc5163.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'knetattach')
-rw-r--r--knetattach/Makefile.am14
-rw-r--r--knetattach/TODO4
-rw-r--r--knetattach/hi128-app-knetattach.pngbin0 -> 14284 bytes
-rw-r--r--knetattach/hi16-app-knetattach.pngbin0 -> 894 bytes
-rw-r--r--knetattach/hi22-app-knetattach.pngbin0 -> 1396 bytes
-rw-r--r--knetattach/hi32-app-knetattach.pngbin0 -> 2350 bytes
-rw-r--r--knetattach/hi48-app-knetattach.pngbin0 -> 4204 bytes
-rw-r--r--knetattach/hi64-app-knetattach.pngbin0 -> 6115 bytes
-rw-r--r--knetattach/hisc-app-knetattach.svgzbin0 -> 6038 bytes
-rw-r--r--knetattach/knetattach.desktop82
-rw-r--r--knetattach/knetattach.ui440
-rw-r--r--knetattach/knetattach.ui.h288
-rw-r--r--knetattach/main.cpp46
13 files changed, 874 insertions, 0 deletions
diff --git a/knetattach/Makefile.am b/knetattach/Makefile.am
new file mode 100644
index 000000000..79bdadfa2
--- /dev/null
+++ b/knetattach/Makefile.am
@@ -0,0 +1,14 @@
+INCLUDES= $(all_includes)
+
+bin_PROGRAMS = knetattach
+knetattach_SOURCES = knetattach.ui main.cpp
+knetattach_LDFLAGS = $(all_libraries) $(KDE_RPATH)
+knetattach_LDADD = $(LIB_KIO)
+METASOURCES = AUTO
+xdg_apps_DATA = knetattach.desktop
+KDE_ICON = AUTO
+
+messages: rc.cpp
+ $(XGETTEXT) *.cpp *.h -o $(podir)/knetattach.pot
+
+knetattach.lo: knetattach.ui knetattach.ui.h
diff --git a/knetattach/TODO b/knetattach/TODO
new file mode 100644
index 000000000..f4651b767
--- /dev/null
+++ b/knetattach/TODO
@@ -0,0 +1,4 @@
+- add a browser for SMB?
+- plugin / desktop file interface for adding more protocols
+- integrate kdnssd?
+
diff --git a/knetattach/hi128-app-knetattach.png b/knetattach/hi128-app-knetattach.png
new file mode 100644
index 000000000..9fb0d1fb2
--- /dev/null
+++ b/knetattach/hi128-app-knetattach.png
Binary files differ
diff --git a/knetattach/hi16-app-knetattach.png b/knetattach/hi16-app-knetattach.png
new file mode 100644
index 000000000..3c5dbdf05
--- /dev/null
+++ b/knetattach/hi16-app-knetattach.png
Binary files differ
diff --git a/knetattach/hi22-app-knetattach.png b/knetattach/hi22-app-knetattach.png
new file mode 100644
index 000000000..eb61b0f3b
--- /dev/null
+++ b/knetattach/hi22-app-knetattach.png
Binary files differ
diff --git a/knetattach/hi32-app-knetattach.png b/knetattach/hi32-app-knetattach.png
new file mode 100644
index 000000000..a3ee15c4a
--- /dev/null
+++ b/knetattach/hi32-app-knetattach.png
Binary files differ
diff --git a/knetattach/hi48-app-knetattach.png b/knetattach/hi48-app-knetattach.png
new file mode 100644
index 000000000..76e8f92f5
--- /dev/null
+++ b/knetattach/hi48-app-knetattach.png
Binary files differ
diff --git a/knetattach/hi64-app-knetattach.png b/knetattach/hi64-app-knetattach.png
new file mode 100644
index 000000000..839300b99
--- /dev/null
+++ b/knetattach/hi64-app-knetattach.png
Binary files differ
diff --git a/knetattach/hisc-app-knetattach.svgz b/knetattach/hisc-app-knetattach.svgz
new file mode 100644
index 000000000..b640e95b8
--- /dev/null
+++ b/knetattach/hisc-app-knetattach.svgz
Binary files differ
diff --git a/knetattach/knetattach.desktop b/knetattach/knetattach.desktop
new file mode 100644
index 000000000..240367905
--- /dev/null
+++ b/knetattach/knetattach.desktop
@@ -0,0 +1,82 @@
+[Desktop Entry]
+Name=KNetAttach
+Name[bn]=কে-নেট-অ্যাটাচ
+Name[ne]=के नेट सङ्लग्न
+Name[sv]=Knetattach
+Name[ta]=நெட்ஹாக்இணைப்பு
+Name[te]=కెనెట్ ఎటాచ్
+Name[vi]=Tấn công Mạng KDE
+GenericName=Network Folder Wizard
+GenericName[af]=Netwerk Gids Assistent
+GenericName[ar]=مرشد مجلّد الشبكة
+GenericName[be]=Майстар сеткавай тэчкі
+GenericName[bg]=Мрежови инструмент
+GenericName[bn]=নেটওয়ার্ক ফোল্ডার উইজার্ড
+GenericName[br]=Skoazeller renkell rouedad
+GenericName[bs]=Čarobnjak za mrežne foldere
+GenericName[ca]=Assistent de carpeta de xarxa
+GenericName[cs]=Průvodce síťovou složkou
+GenericName[csb]=Asystenta sécowëch katalogów
+GenericName[da]=Guide til netværksmappe
+GenericName[de]=Assistent für Netzwerkordner
+GenericName[el]=Μάγος Φακέλων Δικτύου
+GenericName[eo]=Retdosierujo-analizilo
+GenericName[es]=Asistente de carpetas de red
+GenericName[et]=Võrgukataloogide nõustaja
+GenericName[eu]=Sareko karpeten morroia
+GenericName[fa]=جادوگر پوشۀ شبکه
+GenericName[fi]=Verkkokansiotyökalu
+GenericName[fr]=Assistant dossier réseau
+GenericName[fy]=Netwurkmap-assistint
+GenericName[ga]=Treoraí Fillteáin Líonra
+GenericName[gl]=Asistente para Compartición de Cartafoles
+GenericName[he]=אשף תיקיית רשת
+GenericName[hr]=Čarobnjak mrežnih mapa
+GenericName[hu]=Varázsló hálózati mappa beállításához
+GenericName[is]=Netmöppuálfur
+GenericName[it]=Assistente per le cartelle di rete
+GenericName[ja]=ネットワーク フォルダ ウィザード
+GenericName[ka]=ქსელურ საქარალდეთა ოსტატი
+GenericName[kk]=Желідегі қапшық шебері
+GenericName[km]=អ្នក​ជំនួយការ​ថត​បណ្ដាញ
+GenericName[ko]=네트워크 폴더 마법사
+GenericName[lt]=Tinklo aplanko vedlys
+GenericName[mk]=Волшебник за мрежни папки
+GenericName[ms]=Wizard Folder Rangkaian
+GenericName[nb]=Veiviser for nettverksmappe
+GenericName[nds]=Hölper för Nettwarkorner
+GenericName[ne]=सञ्जाल फोल्डर विजार्ड
+GenericName[nl]=Netwerkmap-assistent
+GenericName[nn]=Vegvisar for nettverksmappe
+GenericName[pa]=ਨੈੱਟਵਰਕ ਫੋਲਡਰ ਸਹਾਇਕ
+GenericName[pl]=Asystent folderów sieciowych
+GenericName[pt]=Assistente de Pastas de Rede
+GenericName[pt_BR]=Assistente de Pastas de Rede
+GenericName[ro]=Expert folder de rețea
+GenericName[ru]=Мастер сетевых папок
+GenericName[rw]=Inyobora Ububiko Urusobemiyoboro
+GenericName[sk]=Sprievodca sieťových priečinkov
+GenericName[sl]=Čarovnik za omrežne mape
+GenericName[sr]=Чаробњак за мрежне фасцикле
+GenericName[sr@Latn]=Čarobnjak za mrežne fascikle
+GenericName[sv]=Nätverkskatalogguide
+GenericName[ta]=வலைப்பின்னல் அடைவு பகுதி
+GenericName[tg]=Устоди феҳрастҳои шабака
+GenericName[th]=โปรแกรมวิซาร์ดสำหรับโฟลเดอร์เครือข่าย
+GenericName[tr]=Ağ Kaynağı Sihirbazı
+GenericName[tt]=Çeltärle Törgäk Xikmätçese
+GenericName[uk]=Майстер мережевих тек
+GenericName[uz]=Tarmoq jildi boʻyicha yordamchi
+GenericName[uz@cyrillic]=Тармоқ жилди бўйича ёрдамчи
+GenericName[vi]=Trình thao tác Thư mục Mạng
+GenericName[wa]=Usteye d' ridant rantoele
+GenericName[zh_CN]=网络文件夹向导
+GenericName[zh_TW]=網路資料夾精靈
+Exec=knetattach
+InitialPreference=6
+Icon=knetattach
+Type=Application
+Terminal=false
+X-KDE-StartupNotify=true
+Categories=Qt;KDE;Network;
+DocPath=knetattach/index.html
diff --git a/knetattach/knetattach.ui b/knetattach/knetattach.ui
new file mode 100644
index 000000000..b93a7e62f
--- /dev/null
+++ b/knetattach/knetattach.ui
@@ -0,0 +1,440 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KNetAttach</class>
+<widget class="QWizard">
+ <property name="name">
+ <cstring>KNetAttach</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>594</width>
+ <height>371</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Network Folder Wizard</string>
+ </property>
+ <property name="titleFont">
+ <font>
+ <pointsize>16</pointsize>
+ </font>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>_folderType</cstring>
+ </property>
+ <attribute name="title">
+ <string>Add Network Folder</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QButtonGroup" row="2" column="0">
+ <property name="name">
+ <cstring>buttonGroup1</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Plain</enum>
+ </property>
+ <property name="title">
+ <string></string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QRadioButton" row="4" column="0">
+ <property name="name">
+ <cstring>_recent</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Recent connection:</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton" row="0" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>_webfolder</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;WebFolder (webdav)</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QRadioButton" row="3" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>_fish</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Secure shell (ssh)</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="KComboBox" row="4" column="1">
+ <property name="name">
+ <cstring>_recentConnectionName</cstring>
+ </property>
+ <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>
+ <widget class="QRadioButton" row="1" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>_ftp</cstring>
+ </property>
+ <property name="text">
+ <string>FT&amp;P</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton" row="2" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>_smb</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Microsoft® Windows® network drive</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer row="3" column="0">
+ <property name="name">
+ <cstring>spacer2_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>31</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <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>WordBreak|AlignVCenter</set>
+ </property>
+ </widget>
+ <spacer row="1" column="0">
+ <property name="name">
+ <cstring>spacer20</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Fixed</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>_folderParameters</cstring>
+ </property>
+ <attribute name="title">
+ <string>Network Folder Information</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>_informationText</cstring>
+ </property>
+ <property name="text">
+ <string>Enter a name for this &lt;i&gt;%1&lt;/i&gt; as well as the server address, port and folder path to use and press the Next button.</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignVCenter</set>
+ </property>
+ </widget>
+ <spacer row="1" column="2">
+ <property name="name">
+ <cstring>spacer20_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Fixed</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel4_2</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Name:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>_connectionName</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="2" column="1" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>_connectionName</cstring>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="5" column="1">
+ <property name="name">
+ <cstring>_port</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maxValue">
+ <number>65535</number>
+ </property>
+ <property name="minValue">
+ <number>1</number>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="6" column="1" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>_path</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>_userText</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;User:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>_user</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Se&amp;rver:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>_host</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="5" column="0">
+ <property name="name">
+ <cstring>_portText</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Port:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>_port</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="3" column="1" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>_user</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>10</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="4" column="1" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>_host</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>10</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QLabel" row="6" column="0">
+ <property name="name">
+ <cstring>textLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Folder:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>_path</cstring>
+ </property>
+ </widget>
+ <spacer row="9" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>spacer5</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>560</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QCheckBox" row="7" column="1" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>_createIcon</cstring>
+ </property>
+ <property name="text">
+ <string>Cr&amp;eate an icon for this remote folder</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="8" column="1" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>_useEncryption</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Use encryption</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+</widget>
+<connections>
+ <connection>
+ <sender>_recent</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>_recentConnectionName</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>_user</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>KNetAttach</receiver>
+ <slot>updateParametersPageStatus()</slot>
+ </connection>
+ <connection>
+ <sender>_host</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>KNetAttach</receiver>
+ <slot>updateParametersPageStatus()</slot>
+ </connection>
+ <connection>
+ <sender>_path</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>KNetAttach</receiver>
+ <slot>updateParametersPageStatus()</slot>
+ </connection>
+ <connection>
+ <sender>_useEncryption</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>KNetAttach</receiver>
+ <slot>updatePort(bool)</slot>
+ </connection>
+ <connection>
+ <sender>_createIcon</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>KNetAttach</receiver>
+ <slot>updateFinishButtonText(bool)</slot>
+ </connection>
+</connections>
+<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" impldecl="in implementation">kio/netaccess.h</include>
+ <include location="global" impldecl="in implementation">kmessagebox.h</include>
+ <include location="global" impldecl="in implementation">kiconloader.h</include>
+ <include location="global" impldecl="in implementation">klocale.h</include>
+ <include location="global" impldecl="in implementation">kglobalsettings.h</include>
+ <include location="global" impldecl="in implementation">ksimpleconfig.h</include>
+ <include location="global" impldecl="in implementation">kapplication.h</include>
+ <include location="global" impldecl="in implementation">kstandarddirs.h</include>
+ <include location="global" impldecl="in implementation">kdirnotify_stub.h</include>
+ <include location="global" impldecl="in implementation">kcombobox.h</include>
+ <include location="global" impldecl="in implementation">klineedit.h</include>
+ <include location="global" impldecl="in declaration">kurl.h</include>
+ <include location="local" impldecl="in implementation">knetattach.ui.h</include>
+</includes>
+<variables>
+ <variable access="private">QString _type;</variable>
+</variables>
+<slots>
+ <slot access="private">init()</slot>
+ <slot>setInformationText( const QString &amp; type )</slot>
+ <slot access="private">showPage( QWidget * page )</slot>
+ <slot access="private">updateParametersPageStatus()</slot>
+ <slot access="private">finished()</slot>
+ <slot access="private">updatePort( bool encryption )</slot>
+ <slot access="private">updateFinishButtonText( bool save )</slot>
+</slots>
+<functions>
+ <function access="private" returnType="bool">doConnectionTest( const KURL &amp; url )</function>
+ <function access="private" returnType="bool">updateForProtocol( const QString &amp; protocol )</function>
+</functions>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/knetattach/knetattach.ui.h b/knetattach/knetattach.ui.h
new file mode 100644
index 000000000..de890e228
--- /dev/null
+++ b/knetattach/knetattach.ui.h
@@ -0,0 +1,288 @@
+/****************************************************************************
+** ui.h extension file, included from the uic-generated form implementation.
+**
+** If you want to add, delete, or rename functions or slots, use
+** Qt Designer to update this file, preserving your code.
+**
+** You should not define a constructor or destructor in this file.
+** Instead, write your code in functions called init() and destroy().
+** These will automatically be called by the form's constructor and
+** destructor.
+*****************************************************************************/
+
+void KNetAttach::init()
+{
+ setIcon(SmallIcon("knetattach"));
+ disconnect(finishButton(), SIGNAL(clicked()), (QDialog*)this, SLOT(accept()));
+ connect(finishButton(), SIGNAL(clicked()), this, SLOT(finished()));
+ finishButton()->setText(i18n("Save && C&onnect"));
+ //setResizeMode(Fixed); FIXME: make the wizard fixed-geometry
+ setFinishEnabled(_folderParameters, false);
+ KConfig recent("krecentconnections", true, false);
+ recent.setGroup("General");
+ QStringList idx = recent.readListEntry("Index");
+ if (idx.isEmpty()) {
+ _recent->setEnabled(false);
+ if (_recent->isChecked()) {
+ _webfolder->setChecked(true);
+ }
+ } else {
+ _recent->setEnabled(true);
+ _recentConnectionName->insertStringList(idx);
+ }
+}
+
+void KNetAttach::setInformationText( const QString &type )
+{
+ QString text;
+
+ if (type=="WebFolder") {
+ text = i18n("Enter a name for this <i>WebFolder</i> as well as a server address, port and folder path to use and press the <b>Save & Connect</b> button.");
+ } else if (type=="Fish") {
+ text = i18n("Enter a name for this <i>Secure shell connection</i> as well as a server address, port and folder path to use and press the <b>Save & Connect</b> button.");
+ } else if (type=="FTP") {
+ text = i18n("Enter a name for this <i>File Transfer Protocol connection</i> as well as a server address and folder path to use and press the <b>Save & Connect</b> button.");
+ } else if (type=="SMB") {
+ text = i18n("Enter a name for this <i>Microsoft Windows network drive</i> as well as a server address and folder path to use and press the <b>Save & Connect</b> button.");
+ }
+
+ _informationText->setText(text);
+}
+
+void KNetAttach::showPage( QWidget *page )
+{
+ if (page == _folderType) {
+ } else if (page == _folderParameters) {
+ _host->setFocus();
+ _connectionName->setFocus();
+
+ if (_webfolder->isChecked()) {
+ setInformationText("WebFolder");
+ updateForProtocol("WebFolder");
+ _port->setValue(80);
+ } else if (_fish->isChecked()) {
+ setInformationText("Fish");
+ updateForProtocol("Fish");
+ _port->setValue(22);
+ } else if (_ftp->isChecked()) {
+ setInformationText("FTP");
+ updateForProtocol("FTP");
+ _port->setValue(21);
+ if (_path->text().isEmpty()) {
+ _path->setText("/");
+ }
+ } else if (_smb->isChecked()) {
+ setInformationText("SMB");
+ updateForProtocol("SMB");
+ } else { //if (_recent->isChecked()) {
+ KConfig recent("krecentconnections", true, false);
+ if (!recent.hasGroup(_recentConnectionName->currentText())) {
+ recent.setGroup("General");
+ QStringList idx = recent.readListEntry("Index");
+ if (idx.isEmpty()) {
+ _recent->setEnabled(false);
+ if (_recent->isChecked()) {
+ _webfolder->setChecked(true);
+ }
+ } else {
+ _recent->setEnabled(true);
+ _recentConnectionName->insertStringList(idx);
+ }
+ showPage(_folderType);
+ return;
+ }
+ recent.setGroup(_recentConnectionName->currentText());
+ _type = recent.readEntry("Type");
+ setInformationText(_type);
+ if (!updateForProtocol(_type)) {
+ // FIXME: handle error
+ }
+ KURL u(recent.readEntry("URL"));
+ _host->setText(u.host());
+ _user->setText(u.user());
+ _path->setText(u.path());
+ if (recent.hasKey("Port")) {
+ _port->setValue(recent.readNumEntry("Port"));
+ } else {
+ _port->setValue(u.port());
+ }
+ _connectionName->setText(_recentConnectionName->currentText());
+ _createIcon->setChecked(false);
+ }
+ updateParametersPageStatus();
+ }
+
+ QWizard::showPage(page);
+}
+
+
+void KNetAttach::updateParametersPageStatus()
+{
+ setFinishEnabled(_folderParameters,
+ !_host->text().stripWhiteSpace().isEmpty() &&
+ !_path->text().stripWhiteSpace().isEmpty() &&
+ !_connectionName->text().stripWhiteSpace().isEmpty());
+}
+
+void KNetAttach::finished()
+{
+ setBackEnabled(_folderParameters,false);
+ setFinishEnabled(_folderParameters, false);
+ KURL url;
+ if (_type == "WebFolder") {
+ if (_useEncryption->isChecked()) {
+ url.setProtocol("webdavs");
+ } else {
+ url.setProtocol("webdav");
+ }
+ url.setPort(_port->value());
+ } else if (_type == "Fish") {
+ url.setProtocol("fish");
+ url.setPort(_port->value());
+ } else if (_type == "FTP") {
+ url.setProtocol("ftp");
+ url.setPort(_port->value());
+ } else if (_type == "SMB") {
+ url.setProtocol("smb");
+ } else { // recent
+ }
+
+ url.setHost(_host->text().stripWhiteSpace());
+ url.setUser(_user->text().stripWhiteSpace());
+ QString path = _path->text().stripWhiteSpace();
+ if (!path.startsWith("/")) {
+ path = QString("/") + path;
+ }
+ url.setPath(path);
+ _folderParameters->setEnabled(false);
+ bool success = doConnectionTest(url);
+ _folderParameters->setEnabled(true);
+ if (!success) {
+ KMessageBox::sorry(this, i18n("Unable to connect to server. Please check your settings and try again."));
+ showPage(_folderParameters);
+ setBackEnabled(_folderParameters, true);
+ return;
+ }
+
+ kapp->invokeBrowser(url.url());
+
+ QString name = _connectionName->text().stripWhiteSpace();
+
+ if (_createIcon->isChecked()) {
+ KGlobal::dirs()->addResourceType("remote_entries",
+ KStandardDirs::kde_default("data") + "remoteview");
+
+ QString path = KGlobal::dirs()->saveLocation("remote_entries");
+ path += name + ".desktop";
+ KSimpleConfig desktopFile(path, false);
+ desktopFile.setGroup("Desktop Entry");
+ desktopFile.writeEntry("Icon", "package_network");
+ desktopFile.writeEntry("Name", name);
+ desktopFile.writeEntry("Type", "Link");
+ desktopFile.writeEntry("URL", url.prettyURL());
+ desktopFile.sync();
+ KDirNotify_stub notifier("*", "*");
+ notifier.FilesAdded( "remote:/" );
+ }
+
+ if (!name.isEmpty()) {
+ KConfig recent("krecentconnections", false, false);
+ recent.setGroup("General");
+ QStringList idx = recent.readListEntry("Index");
+ recent.deleteGroup(name); // erase anything stale
+ if (idx.contains(name)) {
+ idx.remove(name);
+ idx.prepend(name);
+ recent.writeEntry("Index", idx);
+ recent.setGroup(name);
+ } else {
+ QString last;
+ if (!idx.isEmpty()) {
+ last = idx.last();
+ idx.pop_back();
+ }
+ idx.prepend(name);
+ recent.deleteGroup(last);
+ recent.writeEntry("Index", idx);
+ }
+ recent.setGroup(name);
+ recent.writeEntry("URL", url.prettyURL());
+ if (_type == "WebFolder" || _type == "Fish" || _type == "FTP") {
+ recent.writeEntry("Port", _port->value());
+ }
+ recent.writeEntry("Type", _type);
+ recent.sync();
+ }
+
+ QDialog::accept();
+}
+
+
+void KNetAttach::updatePort(bool encryption)
+{
+ if (_webfolder->isChecked()) {
+ if (encryption) {
+ _port->setValue(443);
+ } else {
+ _port->setValue(80);
+ }
+ }
+}
+
+
+bool KNetAttach::doConnectionTest(const KURL& url)
+{
+ KIO::UDSEntry entry;
+ if (KIO::NetAccess::stat(url, entry, this)) {
+ // Anything to test here?
+ return true;
+ }
+ return false;
+}
+
+
+bool KNetAttach::updateForProtocol(const QString& protocol)
+{
+ _type = protocol;
+ if (protocol == "WebFolder") {
+ _useEncryption->show();
+ _portText->show();
+ _port->show();
+ _userText->show();
+ _user->show();
+ } else if (protocol == "Fish") {
+ _useEncryption->hide();
+ _portText->show();
+ _port->show();
+ _userText->show();
+ _user->show();
+ } else if (protocol == "FTP") {
+ _useEncryption->hide();
+ _portText->show();
+ _port->show();
+ _userText->show();
+ _user->show();
+ } else if (protocol == "SMB") {
+ _useEncryption->hide();
+ _portText->hide();
+ _port->hide();
+ _userText->hide();
+ _user->hide();
+ } else {
+ _type = "";
+ return false;
+ }
+ return true;
+}
+
+
+void KNetAttach::updateFinishButtonText(bool save)
+{
+ if (save) {
+ finishButton()->setText(i18n("Save && C&onnect"));
+ } else {
+ finishButton()->setText(i18n("C&onnect"));
+ }
+}
+
+// vim: ts=8 sw=4 noet
diff --git a/knetattach/main.cpp b/knetattach/main.cpp
new file mode 100644
index 000000000..8a1f3a832
--- /dev/null
+++ b/knetattach/main.cpp
@@ -0,0 +1,46 @@
+/*
+ Copyright (C) 2004 George Staikos <[email protected]>
+
+ 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; see the file COPYING. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+ */
+
+#include <kaboutdata.h>
+#include <kapplication.h>
+#include <kcmdlineargs.h>
+#include <kglobal.h>
+#include <klocale.h>
+
+#include "knetattach.h"
+
+int main(int argc, char **argv) {
+ KAboutData about("knetattach", I18N_NOOP("KDE Network Wizard"), "1.0",
+ I18N_NOOP("KDE Network Wizard"),
+ KAboutData::License_GPL,
+ I18N_NOOP("(c) 2004 George Staikos"), 0,
+ "http://www.kde.org/");
+
+ about.addAuthor("George Staikos", I18N_NOOP("Primary author and maintainer"), "[email protected]");
+
+ KCmdLineArgs::init(argc, argv, &about);
+ KApplication a;
+
+ KNetAttach na;
+ a.setMainWidget(&na);
+ na.show();
+
+ return a.exec();
+}
+