summaryrefslogtreecommitdiffstats
path: root/filesharing/advanced/propsdlgplugin
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
commitbcb704366cb5e333a626c18c308c7e0448a8e69f (patch)
treef0d6ab7d78ecdd9207cf46536376b44b91a1ca71 /filesharing/advanced/propsdlgplugin
downloadtdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.tar.gz
tdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.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/kdenetwork@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'filesharing/advanced/propsdlgplugin')
-rw-r--r--filesharing/advanced/propsdlgplugin/Makefile.am25
-rw-r--r--filesharing/advanced/propsdlgplugin/fileshare_propsdlgplugin.desktop102
-rw-r--r--filesharing/advanced/propsdlgplugin/propertiespage.cpp612
-rw-r--r--filesharing/advanced/propsdlgplugin/propertiespage.h87
-rw-r--r--filesharing/advanced/propsdlgplugin/propertiespagegui.ui478
-rw-r--r--filesharing/advanced/propsdlgplugin/propertiespagegui.ui.h56
-rw-r--r--filesharing/advanced/propsdlgplugin/propsdlgshareplugin.cpp126
-rw-r--r--filesharing/advanced/propsdlgplugin/propsdlgshareplugin.h44
8 files changed, 1530 insertions, 0 deletions
diff --git a/filesharing/advanced/propsdlgplugin/Makefile.am b/filesharing/advanced/propsdlgplugin/Makefile.am
new file mode 100644
index 00000000..7322f0a8
--- /dev/null
+++ b/filesharing/advanced/propsdlgplugin/Makefile.am
@@ -0,0 +1,25 @@
+METASOURCES = AUTO
+
+
+kde_module_LTLIBRARIES = fileshare_propsdlgplugin.la
+
+fileshare_propsdlgplugin_la_SOURCES = \
+ propsdlgshareplugin.cpp
+
+fileshare_propsdlgplugin_la_COMPILE_FIRST = propertiespagegui.h
+
+fileshare_propsdlgplugin_la_LIBADD = \
+ libpropsdlgplugin_common.la \
+ ../nfs/libfilesharenfs.la \
+ ../kcm_sambaconf/libfilesharesamba.la \
+ $(LIB_KIO)
+
+fileshare_propsdlgplugin_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN)
+
+AM_CPPFLAGS = -I../kcm_sambaconf $(all_includes)
+
+kde_services_DATA = fileshare_propsdlgplugin.desktop
+
+# Shared with the 'simple' kcm
+noinst_LTLIBRARIES = libpropsdlgplugin_common.la
+libpropsdlgplugin_common_la_SOURCES = propertiespage.cpp propertiespagegui.ui
diff --git a/filesharing/advanced/propsdlgplugin/fileshare_propsdlgplugin.desktop b/filesharing/advanced/propsdlgplugin/fileshare_propsdlgplugin.desktop
new file mode 100644
index 00000000..f6064ed5
--- /dev/null
+++ b/filesharing/advanced/propsdlgplugin/fileshare_propsdlgplugin.desktop
@@ -0,0 +1,102 @@
+[Desktop Entry]
+Type=Service
+Icon=fileshare
+Name=Fileshare Konqueror Directory Properties Page
+Name[bg]=Настройки за приставката за браузъра за споделяна на файлове
+Name[bn]=ফাইল ভাগাভাগি কনকরার ডিরেক্টরী বৈশিষ্ট্যাবলী পাতা
+Name[bs]=Stranica sa osobinama dijeljenja direktorija u Konqueroru
+Name[ca]=Pàgina de propietats de compartició de fitxers Konqueror
+Name[cs]=Stránka vlastností adresáře sdílení Konqueroru
+Name[da]=Fileshare Konqueror-mappens side med egenskaber
+Name[de]=Dateifreigabe Konqueror Ordner-Eigenschaftenseite
+Name[el]=Σελίδα ιδιοτήτων κοινόχρηστου καταλόγου του Konqueror
+Name[eo]=dosierujo-eco-paĝo
+Name[es]=Página de propiedades del directorio para compartir archivos de Konqueror
+Name[et]=Failijagamise Konquerori kataloogi omaduste lehekülg
+Name[eu]=Fitxategiak partekatzeko Konqueror direktorio propietateen orria
+Name[fa]=صفحۀ ویژگیهای فهرست راهنمای اشتراک پروندۀ Konqueror
+Name[fi]=Konquerorin tiedostojakojen ominaisuussivu
+Name[fr]=Page des propriétés d'un dossier de partage de Konqueror
+Name[gl]=Páxina coas Propiedades do Directorio de Ficheiros Compartidos de Konqueror
+Name[he]=דף מאפייני ספרית קבצים משותפת של Konqueror
+Name[hu]=Fájlmegosztási lap a Konqueror könyvtártulajdonságainál
+Name[is]=Skráastjóraeiginleikar Konqueror
+Name[it]=Pagina delle proprietà di Konqueror per la condivisione
+Name[ja]=Konqueror でファイル共有するディレクトリのプロパティのページ
+Name[ka]=Konqueror-ის ფაილთა გაზიარების თვისებების გვერდი
+Name[kk]=Konqueror файлдарын ортақтастыру каталогының қасиеттер беті
+Name[km]=ទំព័រ​លក្ខណៈ​សម្បត្តិ​ថត Konqueror សម្រាប់​ការ​ចែក​រំលែក
+Name[lt]=Bylų dalinimosi Konqueror aplanko nustatymų puslapis
+Name[mk]=Страница со параметри за делен именик во Konqueror
+Name[nb]=Fildeler – Side i Konquerors mappegenskaper
+Name[nds]=Konqueror Ornerfreegaav-Egenschappensiet
+Name[ne]=फाइल साझेदारी कन्क्वेरर डाइरेक्टरी विशेषता पृष्ठ
+Name[nl]=Configuratiepagina Konqueror bestanden delen
+Name[nn]=Side for katalogeigenskapar til fildeling i Konqueror
+Name[pa]=ਫਾਇਲ ਸਾਂਝ ਕੋਨਕਿਊਰੋਰ ਡਾਇਰੈਕਟਰੀ ਵਿਸ਼ੇਸ਼ਤਾ ਸਫ਼ਾ
+Name[pl]=Strona współdzielenia we właściwościach katalogu w Konquerorze
+Name[pt]=Página de Propriedades da Pasta de Partilha do Konqueror
+Name[pt_BR]=Página de Propriedades do Diretório de Compartilhamento de Arquivos do Konqueror
+Name[ru]=Страница свойств каталога для общего доступа
+Name[sk]=Nastavenie zdieľania priečinkov pre Konqueror
+Name[sl]=Stran z lastnostmi za souporabo mape
+Name[sr]=Страна Konqueror-а са својствима директоријума за дељење фајлова
+Name[sr@Latn]=Strana Konqueror-a sa svojstvima direktorijuma za deljenje fajlova
+Name[sv]=Konquerors fildelningssida med katalogegenskaper
+Name[ta]=Fileshare Konqueror அடைவு பண்புகளின் பக்கம்
+Name[tg]=Саҳифаи Феҳристи Хусусиятҳо оиди Konqueror Истифодабарии Муштараки Файлҳо
+Name[tr]=Dosya Paylaşımı Konqueror Dizin Özellikleri Sayfası
+Name[uk]=Сторінка властивостей каталогу для спільного доступу
+Name[zh_CN]=文件共享 Konqueror 目录属性页
+Name[zh_HK]=檔案分享 Konqueror 目錄屬性頁
+Name[zh_TW]=Konqueror 檔案分享目錄屬性頁
+Comment=Konqueror properties dialog plugin to share a directory with the local network
+Comment[bg]=Настройка на приставката за браузъра Konqueror за споделяна на директории в локалната мрежа
+Comment[bn]=স্থানীয় নেটওয়ার্কের সঙ্গে একটি ডিরেক্টরী ভাগাভাগি করতে কনকরার বৈশিষ্ট্যাবলী ডায়ালগ প্লাগিন
+Comment[bs]=Dodatak za prozor Konqueror postavki za dijeljenje direktorija u lokalnoj mreži
+Comment[ca]=Diàleg de propietats Konqueror de l'endollable per compartir un directori amb la xarxa local
+Comment[cs]=Modul dialogu vlastností Konqueroru pro sdílení adresářů v lokální síti
+Comment[da]=Konqueror egenskaber-dialog plugin til at dele en mappe med det lokale netværk
+Comment[de]=Konqueror Eigenschaftendialog-Plugin zur Freigabe eines Ordners in einem lokalen Netzwerk
+Comment[el]=Πρόσθετος διάλογος ρυθμίσεων του Konqueror για την κοινή χρήση ενός καταλόγου με το τοπικό δίκτυο
+Comment[en_GB]=Konqueror properties dialogue plugin to share a directory with the local network
+Comment[es]=Complemento de diálogo de propiedades de Konqueror para compartir un directorio con la red local
+Comment[et]=Konquerori omaduste dialoogi plugin kataloogi jagamiseks kohtvõrgus
+Comment[eu]=Konqueror-en propietateen elkarrizketa-koadro plugina direktorio bat sare lokalean partekatzeko
+Comment[fa]=ویژگیهای وصلۀ محاورۀ Konqueror برای اشتراک فهرست راهنما با شبکۀ محلی
+Comment[fi]=Konqueroroin laajennus, jolla voi jakaa kansioita lähiverkossa
+Comment[fr]=Module de Konqueror pour le partage d'un dossier sur le réseau local
+Comment[gl]=Diálogo de propiedades do plugin de Konqueror para compartir coa rede local
+Comment[he]=תוסף מאפייני דו-שיח של Konqueror כדי לשתף סיפריה עם רשת מקומית
+Comment[hu]=Konqueror tulajdonságablak-modul könyvtár megosztásához a helyi hálózaton
+Comment[it]=Plugin delle proprietà di Konqueror per condividere una cartella con la rete locale
+Comment[ja]=ローカルネットワークでディレクトリを共有する Konqueror プロパティダイアログのプラグイン
+Comment[ka]=Konqueror თვისებების დიალოგის მოდული ლოკალურ ქსელთან გასაზიარებლად
+Comment[kk]=Каталогты жергілікті желімен ортақтастыратын Konqueror қасиеттер диалогының плагин модулі
+Comment[km]=ប្រអប់​លក្ខណៈ​សម្បត្តិ Konqueror ដើម្បី​ចែក​រំលែក​ថត​នៅ​ក្នុង​បណ្ដាញ​មូលដ្ឋាន
+Comment[lt]=Konqueror nustatymų dialogo įskiepis, skirtas dalintis aplanku vietiniame tinkle
+Comment[mk]=Приклучок со дијалог за својства во Konqueror за делење на датотеки со локалната мрежа
+Comment[nb]=Programtillegg for Konquerors egenskapsdialog for å dele en mappe på lokalnettet
+Comment[nds]=Moduul för en Konqueror-Egenschappendialoog för't Freegeven vun Ornern in't lokale Nettwark
+Comment[ne]=स्थानीय सञ्जालसँग डाइरेक्टरी साझेदार गर्न कन्क्वेरर विशेषता संवाद प्लगइन
+Comment[nl]=Konqueror-plugin met instellingen om bestanden te delen via het lokale netwerk
+Comment[nn]=Konqueror-vising av eigenskapar til ein delt katalog i det lokale nettverket
+Comment[pl]=Wtyczka właściwości dla Konquerora umożliwiająca współdzielenie katalogu w sieci lokalnej
+Comment[pt]='Plugin' de janela de propriedades do Konqueror para partilhar uma pasta na rede local
+Comment[pt_BR]=Plug-in de diálogo de propriedades do Konqueror para o compartilhamento de uma pasta em uma rede local
+Comment[ru]=Модуль свойств Konqueror для разрешения общего доступа к каталогу из локальной сети
+Comment[sk]=Modul Konquerora pre zdieľanie priečinku v lokálnej sieti
+Comment[sl]=Vstavek za Konqueror s pogovornim oknom za lastnosti za souporabo mape v krajevnem omrežju
+Comment[sr]=Прикључак Konqueror-а за подешавање својстава дељења директоријума у локалној мрежи
+Comment[sr@Latn]=Priključak Konqueror-a za podešavanje svojstava deljenja direktorijuma u lokalnoj mreži
+Comment[sv]=Konqueror-insticksprogram med egenskapsdialogruta för att dela en katalog i det lokala nätverket
+Comment[ta]=Konqueror பண்புகளின் உரையாடல் செருகுகள் அடைவை சம்பா சேவையகத்துடன் பகிரவேண்டிய செருகுகள்
+Comment[tg]=Модули муколамаи хусусиятҳои Konqueror барои истифодабарии муштараки феҳрист бо шабакаи маҳалллӣ
+Comment[tr]=Yerel ağ ile dizin paylaşımı için Konqueror iletişim eklentisi özellikleri
+Comment[uk]=Втулок діалогу властивостей Konqueror для дозволу спільного доступу до каталогу з локальної мережі
+Comment[zh_CN]=可将目录与局域网共享的 Konqueror 属性页对话框插件
+Comment[zh_HK]=用於與本地網絡分享目錄的 Konqueror 屬性對話盒插件
+Comment[zh_TW]=Konqueror 屬性對話框外掛程式,用於在本地端網路上分享目錄
+X-KDE-Library=fileshare_propsdlgplugin
+X-KDE-Protocol=file
+ServiceTypes=KPropsDlg/Plugin,inode/directory
diff --git a/filesharing/advanced/propsdlgplugin/propertiespage.cpp b/filesharing/advanced/propsdlgplugin/propertiespage.cpp
new file mode 100644
index 00000000..e5b349da
--- /dev/null
+++ b/filesharing/advanced/propsdlgplugin/propertiespage.cpp
@@ -0,0 +1,612 @@
+/*
+ Copyright (c) 2004 Jan Schaefer <j_schaef@informatik.uni-kl.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 <qcheckbox.h>
+#include <qtooltip.h>
+#include <qbuttongroup.h>
+#include <qfileinfo.h>
+#include <qlabel.h>
+#include <kpushbutton.h>
+#include <qtimer.h>
+
+#include <kfileshare.h>
+#include <knfsshare.h>
+#include <ksambashare.h>
+#include <klocale.h>
+#include <kurl.h>
+#include <kdebug.h>
+#include <kfile.h>
+#include <kurlrequester.h>
+#include <kmessagebox.h>
+#include <klineedit.h>
+#include <kprocio.h>
+#include <ktempfile.h>
+
+// NFS related
+#include "../nfs/nfsfile.h"
+#include "../nfs/nfsentry.h"
+#include "../nfs/nfsdialog.h"
+
+// Samba related
+#include "../kcm_sambaconf/sambafile.h"
+#include "../kcm_sambaconf/sambashare.h"
+#include "../kcm_sambaconf/sharedlgimpl.h"
+
+#include "propertiespage.h"
+
+#define FILESHARE_DEBUG 5009
+
+PropertiesPage::PropertiesPage(QWidget* parent, KFileItemList items,bool enterUrl)
+ : PropertiesPageGUI(parent),
+ m_enterUrl(enterUrl),
+ m_items(items),
+ m_nfsFile(0),
+ m_nfsEntry(0),
+ m_sambaFile(0),
+ m_sambaShare(0),
+ m_sambaChanged(false),
+ m_nfsChanged(false),
+ m_loaded(false)
+{
+ if (m_items.isEmpty()) {
+ shareFrame->setDisabled(true);
+ } else {
+ shareFrame->setEnabled(true);
+ // currently only one dir is allowed
+ m_path = m_items.first()->url().path(1);
+ }
+
+ if (m_enterUrl) {
+ shareChk->hide();
+ urlRq->setMode(KFile::Directory |
+ KFile::ExistingOnly |
+ KFile::LocalOnly );
+ urlRq->setURL(m_path);
+ connect( urlRq, SIGNAL(textChanged(const QString&)),
+ this, SLOT(urlRqTextChanged(const QString&)));
+ } else {
+ urlRq->hide();
+ folderLbl->hide();
+ }
+
+
+ enableSamba(false,i18n("Reading Samba configuration file ..."));
+ enableNFS(false,i18n("Reading NFS configuration file ..."));
+
+
+ //QTimer::singleShot(1, this, SLOT(load));
+ load();
+}
+
+PropertiesPage::~PropertiesPage()
+{
+ delete m_nfsFile;
+ delete m_sambaFile;
+}
+
+void PropertiesPage::urlRqTextChanged(const QString&) {
+ if (!m_enterUrl)
+ return;
+
+ KURL url(urlRq->url());
+ if (url.isLocalFile()) {
+ QFileInfo info(url.path(1));
+ if (info.exists() &&
+ info.isDir())
+ {
+ shareFrame->setEnabled(true);
+ return;
+ }
+ }
+
+ shareFrame->setDisabled(true);
+}
+
+void PropertiesPage::load() {
+ loadNFS();
+ loadSamba();
+
+ bool nfsShared = KNFSShare::instance()->isDirectoryShared(m_path);
+ bool sambaShared = KSambaShare::instance()->isDirectoryShared(m_path);
+
+ nfsChk->setChecked(nfsShared);
+ sambaChk->setChecked(sambaShared);
+
+ if (!m_enterUrl)
+ shareChk->setChecked(nfsShared || sambaShared);
+
+ m_loaded = true;
+}
+
+void PropertiesPage::enableNFS(bool b, const QString & message) {
+ nfsChk->setEnabled(b);
+ nfsGrp->setEnabled(b);
+ QToolTip::add(nfsChk,message);
+ QToolTip::add(nfsGrp,message);
+}
+
+void PropertiesPage::enableSamba(bool b, const QString & message) {
+ sambaChk->setEnabled(b);
+ sambaGrp->setEnabled(b);
+ QToolTip::add(sambaChk,message);
+ QToolTip::add(sambaGrp,message);
+}
+
+
+bool PropertiesPage::save() {
+ if (!hasChanged()) {
+ kdDebug(FILESHARE_DEBUG) << "PropertiesPage::save: nothing changed." << endl;
+ return true;
+ }
+
+ if (!checkURL()) {
+ kdDebug(FILESHARE_DEBUG) << "PropertiesPage::save: url check failed." << endl;
+ return false;
+ }
+
+ updateNFSEntry();
+ if (!updateSambaShare()) {
+ kdDebug(FILESHARE_DEBUG) << "PropertiesPage::save: updateSambaShare failed!" << endl;
+ return false;
+ }
+
+ return save(m_nfsFile, m_sambaFile, m_nfsChanged, m_sambaChanged);
+}
+
+bool PropertiesPage::save(NFSFile* nfsFile, SambaFile* sambaFile, bool nfs, bool samba)
+{
+ QString nfsFileName = KNFSShare::instance()->exportsPath();
+ bool nfsNeedsKDEsu = false;
+
+ if (nfs) {
+ if (QFileInfo(nfsFileName).isWritable()) {
+ nfsFile->saveTo(nfsFileName);
+ } else {
+ nfsNeedsKDEsu = true;
+ kdDebug(FILESHARE_DEBUG) << "PropertiesPage::save: nfs needs kdesu." << endl;
+ }
+ } else
+ kdDebug(FILESHARE_DEBUG) << "PropertiesPage::save: nfs has not changed." << endl;
+
+
+ QString sambaFileName = KSambaShare::instance()->smbConfPath();
+ bool sambaNeedsKDEsu = false;
+ if (samba) {
+ if (QFileInfo(sambaFileName).isWritable()) {
+ sambaFile->saveTo(sambaFileName);
+ } else {
+ sambaNeedsKDEsu = true;
+ kdDebug(FILESHARE_DEBUG) << "PropertiesPage::save: samba needs kdesu." << endl;
+ }
+ } else
+ kdDebug(FILESHARE_DEBUG) << "PropertiesPage::save: samba has not changed." << endl;
+
+
+ if (nfsNeedsKDEsu || sambaNeedsKDEsu) {
+ KTempFile nfsTempFile;
+ nfsTempFile.setAutoDelete(true);
+ KTempFile sambaTempFile;
+ sambaTempFile.setAutoDelete(true);
+
+ KProcIO proc;
+
+ QString command;
+
+ if (nfsNeedsKDEsu) {
+ nfsFile->saveTo(nfsTempFile.name());
+ command += QString("cp %1 %2;exportfs -ra;")
+ .arg(KProcess::quote( nfsTempFile.name() ))
+ .arg(KProcess::quote( nfsFileName ));
+ }
+
+ if (sambaNeedsKDEsu) {
+ sambaFile->saveTo(sambaTempFile.name());
+ command += QString("cp %1 %2;")
+ .arg(KProcess::quote( sambaTempFile.name() ))
+ .arg(KProcess::quote( sambaFileName ));
+ }
+
+ proc<<"kdesu" << "-d" << "-c"<<command;
+
+ if (!proc.start(KProcess::Block, true)) {
+ kdDebug(FILESHARE_DEBUG) << "PropertiesPage::save: kdesu command failed" << endl;
+ return false;
+ }
+ }
+
+ kdDebug(FILESHARE_DEBUG) << "PropertiesPage::save: Saving successfull." << endl;
+ return true;
+}
+
+bool PropertiesPage::saveSamba() {
+ if (!updateSambaShare()) {
+ return false;
+ }
+
+ if (m_sambaChanged) {
+ kdDebug(FILESHARE_DEBUG) << "PropertiesPage::saveSamba: saving..." << endl;
+ return m_sambaFile->save();
+ }
+
+ kdDebug(FILESHARE_DEBUG) << "PropertiesPage::saveSamba: samba has not changed." << endl;
+ return true;
+}
+
+bool PropertiesPage::saveNFS() {
+ updateNFSEntry();
+ if (!m_nfsChanged) {
+ kdDebug(FILESHARE_DEBUG) << "PropertiesPage::saveNFS: NFS did not change." << endl;
+ return true;
+ }
+
+ kdDebug(FILESHARE_DEBUG) << "PropertiesPage::saveNFS: saving..." << endl;
+ return m_nfsFile->save();
+}
+
+
+
+
+bool PropertiesPage::checkURL() {
+
+ kdDebug(FILESHARE_DEBUG) << "PropertiesPage::checkURL" << endl;
+
+ if (!m_enterUrl)
+ return true;
+
+ kdDebug(FILESHARE_DEBUG) << "PropertiesPage::checkURL: enterUrl=true" << endl;
+
+ KURL url(urlRq->url());
+ QString path = url.path(1);
+
+ kdDebug(FILESHARE_DEBUG) << "PropertiesPage::checkURL: m_path='"
+ << m_path << "'" << endl;
+
+ kdDebug(FILESHARE_DEBUG) << "PropertiesPage::checkURL: path='"
+ << path << "'" << endl;
+
+ if (m_path == path) {
+ kdDebug(FILESHARE_DEBUG) << "PropertiesPage::checkURL: paths are equal" << endl;
+ return true;
+ }
+
+ kdDebug(FILESHARE_DEBUG) << "PropertiesPage::checkURL: different path" << endl;
+
+
+ if (!url.isValid()) {
+ KMessageBox::sorry(this,i18n("Please enter a valid path."));
+ urlRq->setFocus();
+ urlRq->lineEdit()->selectAll();
+ return false;
+ }
+
+ kdDebug(FILESHARE_DEBUG) << "PropertiesPage::checkURL: url is valid" << endl;
+
+ if (!url.isLocalFile()) {
+ KMessageBox::sorry(this,i18n("Only local folders can be shared."));
+ urlRq->setFocus();
+ urlRq->lineEdit()->selectAll();
+ return false;
+ }
+
+ kdDebug(FILESHARE_DEBUG) << "PropertiesPage::checkURL: url is local file" << endl;
+
+ QFileInfo info(path);
+
+ if (!info.exists())
+ {
+ KMessageBox::sorry(this,i18n("The folder does not exists."));
+ urlRq->setFocus();
+ urlRq->lineEdit()->selectAll();
+ return false;
+ }
+
+ kdDebug(FILESHARE_DEBUG) << "PropertiesPage::checkURL: folder exits" << endl;
+
+
+ if (!info.isDir())
+ {
+ KMessageBox::sorry(this,i18n("Only folders can be shared."));
+ urlRq->setFocus();
+ urlRq->lineEdit()->selectAll();
+ return false;
+ }
+
+ kdDebug(FILESHARE_DEBUG) << "PropertiesPage::checkURL: path is dir" << endl;
+
+ if (KSambaShare::instance()->isDirectoryShared(path) ||
+ KNFSShare::instance()->isDirectoryShared(path))
+ {
+ KMessageBox::sorry(this,i18n("The folder is already shared."));
+ urlRq->setFocus();
+ urlRq->lineEdit()->selectAll();
+ return false;
+ }
+
+ kdDebug(FILESHARE_DEBUG) << "PropertiesPage::checkURL: folder not shared yet" << endl;
+ m_path = path;
+
+ return true;
+}
+
+bool PropertiesPage::loadNFS() {
+ if (!KFileShare::nfsEnabled()) {
+ enableNFS(false,i18n("The administrator does not allow sharing with NFS."));
+ return false;
+ }
+
+ delete m_nfsFile;
+ m_nfsFile = new NFSFile(KNFSShare::instance()->exportsPath());
+
+ if (!m_nfsFile->load()) {
+ enableNFS(false,i18n("Error: could not read NFS configuration file."));
+ return false;
+ }
+
+ enableNFS(true,"");
+
+ loadNFSEntry();
+ return true;
+}
+
+void PropertiesPage::loadNFSEntry() {
+ m_nfsEntry = m_nfsFile->getEntryByPath(m_path);
+ m_nfsChanged = false;
+
+ if (!m_nfsEntry) {
+ nfsChk->setChecked(false);
+ return;
+ }
+
+
+ NFSHost* publicHost = m_nfsEntry->getPublicHost();
+
+ if (publicHost) {
+ publicNFSChk->setChecked(true);
+ writableNFSChk->setChecked(!publicHost->readonly);
+ } else
+ publicNFSChk->setChecked(false);
+}
+
+void PropertiesPage::updateNFSEntry() {
+ if (shareChk->isChecked() &&
+ nfsChk->isChecked())
+ {
+ if (!m_nfsEntry) {
+ m_nfsEntry = new NFSEntry(m_path);
+ m_nfsFile->addEntry(m_nfsEntry);
+ m_nfsChanged = true;
+ }
+
+ NFSHost* publicHost = m_nfsEntry->getPublicHost();
+
+ if (publicNFSChk->isChecked()) {
+ if (!publicHost) {
+ publicHost = new NFSHost("*");
+ publicHost->allSquash=true;
+ m_nfsEntry->addHost(publicHost);
+ m_nfsChanged = true;
+ }
+
+ if (publicHost->readonly != !writableNFSChk->isChecked()) {
+ publicHost->readonly = !writableNFSChk->isChecked();
+ m_nfsChanged = true;
+ }
+ } else {
+ if (publicHost) {
+ m_nfsEntry->removeHost(publicHost);
+ m_nfsChanged = true;
+ }
+ }
+ } else { // unshare
+ if (m_nfsEntry) {
+ m_nfsFile->removeEntry(m_nfsEntry);
+ m_nfsEntry = 0;
+ m_nfsChanged = true;
+ }
+ }
+}
+
+void PropertiesPage::moreNFSBtn_clicked() {
+ updateNFSEntry();
+ NFSDialog* dlg = new NFSDialog(this,m_nfsEntry);
+ if (dlg->exec()==QDialog::Accepted &&
+ dlg->modified())
+ {
+ kdDebug(FILESHARE_DEBUG) << "NFSDialog::ok" << endl;
+ loadNFSEntry();
+ m_nfsChanged = true;
+ emit changed();
+ }
+ delete dlg;
+}
+
+bool PropertiesPage::loadSamba() {
+ if (!KFileShare::sambaEnabled()) {
+ enableSamba(false,i18n("The administrator does not allow sharing with Samba."));
+ return false;
+ }
+
+ delete m_sambaFile;
+ m_sambaFile = new SambaFile(KSambaShare::instance()->smbConfPath(), false);
+ if (! m_sambaFile->load()) {
+ enableSamba(false,i18n("Error: could not read Samba configuration file."));
+ return false;
+ }
+
+ enableSamba(true,"");
+ QString shareName = m_sambaFile->findShareByPath(m_path);
+ if (shareName.isNull()) {
+ sambaChk->setChecked(false);
+ kdDebug(FILESHARE_DEBUG) << "PropertiesPage::loadSamba: shareName is null!"
+ << endl;
+ return false;
+ }
+
+ kdDebug(FILESHARE_DEBUG) << "PropertiesPage::loadSamba: shareName="
+ << shareName << endl;
+
+ m_sambaShare = m_sambaFile->getShare(shareName);
+
+ loadSambaShare();
+ return true;
+}
+
+
+void PropertiesPage::loadSambaShare() {
+ if (! m_sambaShare) {
+ sambaChk->setChecked(false);
+ kdDebug(FILESHARE_DEBUG) << "PropertiesPage::loadSambaShare: no share with name "
+ << m_sambaShare->getName() << endl;
+ return;
+ }
+
+ if (m_sambaShare->getBoolValue("public")) {
+ publicSambaChk->setChecked(true);
+ writableSambaChk->setChecked(m_sambaShare->getBoolValue("writable"));
+ } else
+ publicSambaChk->setChecked(false);
+
+
+ sambaNameEdit->setText(m_sambaShare->getName() );
+}
+
+void PropertiesPage::sambaChkToggled( bool b ) {
+ if (!m_loaded)
+ return;
+
+ if (sambaNameEdit->text().isEmpty())
+ sambaNameEdit->setText(getNewSambaName());
+}
+
+bool PropertiesPage::updateSambaShare() {
+ kdDebug(FILESHARE_DEBUG) << "PropertiesPage::updateSambaShare" << endl;
+
+ if (shareChk->isChecked() &&
+ sambaChk->isChecked())
+ {
+ if (m_enterUrl) {
+ if (m_path != urlRq->url()) {
+ m_path = urlRq->url();
+ }
+ }
+
+ kdDebug(FILESHARE_DEBUG) << "PropertiesPage::updateSambaShare: m_path"
+ << m_path << endl;
+
+ if (!m_sambaShare) {
+ createNewSambaShare();
+ m_sambaChanged = true;
+ }
+
+ setSambaShareBoolValue("public", publicSambaChk);
+ setSambaShareBoolValue("writable", writableSambaChk);
+
+ if (sambaNameEdit->text().isEmpty()) {
+ KMessageBox::sorry(this, i18n("You have to enter a name for the Samba share."));
+ sambaNameEdit->setFocus();
+ return false;
+ }
+
+ if (sambaNameEdit->text() != m_sambaShare->getName()) {
+ SambaShare* otherShare = m_sambaFile->getShare(sambaNameEdit->text());
+ if (otherShare && otherShare != m_sambaShare) {
+ // There is another Share with the same name
+ KMessageBox::sorry(this, i18n("<qt>There is already a share with the name <strong>%1</strong>.<br> Please choose another name.</qt>").arg(sambaNameEdit->text()));
+ sambaNameEdit->selectAll();
+ sambaNameEdit->setFocus();
+ return false;
+ }
+ m_sambaShare->setName(sambaNameEdit->text());
+ m_sambaChanged = true;
+ }
+
+ if (m_sambaShare->getValue("path") != m_path) {
+ m_sambaShare->setValue("path", m_path);
+ m_sambaChanged = true;
+ }
+
+ } else {
+ if (m_sambaShare) {
+ kdDebug(FILESHARE_DEBUG) << "PropertiesPage::updateSambaShare: removing share" << endl;
+ m_sambaFile->removeShare(m_sambaShare);
+ m_sambaShare = 0;
+ m_sambaChanged = true;
+ }
+ }
+ return true;
+}
+
+void PropertiesPage::setSambaShareBoolValue(const QString & value,
+ QCheckBox* chk)
+{
+ bool v = m_sambaShare->getBoolValue(value);
+ if (v == chk->isChecked())
+ return;
+
+ m_sambaShare->setValue(value,chk->isChecked());
+ m_sambaChanged = true;
+}
+
+QString PropertiesPage::getNewSambaName() {
+ QString path = m_path;
+ if (path.isNull() && m_enterUrl) {
+ path = urlRq->url();
+ }
+
+ QString shareName = KURL(path).fileName();
+
+ if (!sambaNameEdit->text().isEmpty())
+ shareName = sambaNameEdit->text();
+
+ // Windows could have problems with longer names
+ shareName = shareName.left(12).upper();
+
+ if ( m_sambaFile->getShare(shareName) )
+ shareName = m_sambaFile->getUnusedName(shareName);
+
+ return shareName;
+}
+
+void PropertiesPage::createNewSambaShare() {
+
+ m_sambaShare = m_sambaFile->newShare(getNewSambaName(),m_path);
+
+ kdDebug(FILESHARE_DEBUG) << "PropertiesPage::createNewSambaShare: "
+ << m_sambaShare->getName() << endl;
+
+}
+
+
+void PropertiesPage::moreSambaBtnClicked() {
+ kdDebug(FILESHARE_DEBUG) << "PropertiesPage::moreSambaBtnClicked()" << endl;
+ updateSambaShare();
+ ShareDlgImpl* dlg = new ShareDlgImpl(this,m_sambaShare);
+ dlg->directoryGrp->hide();
+ dlg->pixmapFrame->hide();
+ if (dlg->exec() == QDialog::Accepted &&
+ dlg->hasChanged()) {
+ m_sambaChanged = true;
+ changedSlot();
+ loadSambaShare();
+ }
+ delete dlg;
+}
+
+#include "propertiespage.moc"
+
diff --git a/filesharing/advanced/propsdlgplugin/propertiespage.h b/filesharing/advanced/propsdlgplugin/propertiespage.h
new file mode 100644
index 00000000..3becf6e7
--- /dev/null
+++ b/filesharing/advanced/propsdlgplugin/propertiespage.h
@@ -0,0 +1,87 @@
+/*
+ Copyright (c) 2004 Jan Schaefer <j_schaef@informatik.uni-kl.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.
+
+*/
+
+#ifndef PROPERTIESPAGE_H
+#define PROPERTIESPAGE_H
+
+#include <kfileitem.h>
+#include "propertiespagegui.h"
+
+class NFSFile;
+class NFSEntry;
+class SambaFile;
+class SambaShare;
+class QCheckBox;
+
+class PropertiesPage : public PropertiesPageGUI
+{
+Q_OBJECT
+public:
+ PropertiesPage(QWidget* parent, KFileItemList items, bool enterUrl=false);
+ virtual ~PropertiesPage();
+
+ bool save();
+
+ static bool save(NFSFile* nfsFile, SambaFile* sambFile, bool nfs, bool samba);
+public slots:
+ void load();
+
+protected:
+
+ bool m_enterUrl;
+ QString m_path;
+ KFileItemList m_items;
+ NFSFile *m_nfsFile;
+ NFSEntry *m_nfsEntry;
+
+ SambaFile *m_sambaFile;
+ SambaShare *m_sambaShare;
+ bool m_sambaChanged;
+ bool m_nfsChanged;
+ bool m_loaded;
+
+protected slots:
+ // inherited from PropertiesPageGUI
+ virtual void moreNFSBtn_clicked();
+ virtual void moreSambaBtnClicked();
+ virtual void sambaChkToggled( bool b );
+ virtual void urlRqTextChanged(const QString&);
+
+private:
+ bool loadNFS();
+ void loadNFSEntry();
+ void updateNFSEntry();
+ bool saveNFS();
+
+ bool loadSamba();
+ void loadSambaShare();
+ bool updateSambaShare();
+ bool saveSamba();
+
+ bool checkURL();
+ void setSambaShareBoolValue(const QString & value, QCheckBox* chk);
+ void createNewSambaShare();
+ QString getNewSambaName();
+
+ void enableNFS(bool b,const QString & message);
+ void enableSamba(bool b,const QString & message);
+
+};
+
+#endif
diff --git a/filesharing/advanced/propsdlgplugin/propertiespagegui.ui b/filesharing/advanced/propsdlgplugin/propertiespagegui.ui
new file mode 100644
index 00000000..4f756d3b
--- /dev/null
+++ b/filesharing/advanced/propsdlgplugin/propertiespagegui.ui
@@ -0,0 +1,478 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>PropertiesPageGUI</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>PropertiesPageGUI</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>433</width>
+ <height>348</height>
+ </rect>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout6</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>folderLbl</cstring>
+ </property>
+ <property name="text">
+ <string>Folder:</string>
+ </property>
+ </widget>
+ <widget class="KURLRequester">
+ <property name="name">
+ <cstring>urlRq</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>shareChk</cstring>
+ </property>
+ <property name="text">
+ <string>S&amp;hare this folder in the local network</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="Line">
+ <property name="name">
+ <cstring>line1</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>HLine</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ <widget class="QFrame">
+ <property name="name">
+ <cstring>shareFrame</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Raised</enum>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>nfsChk</cstring>
+ </property>
+ <property name="text">
+ <string>Share with &amp;NFS (Linux/UNIX)</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>nfsGrp</cstring>
+ </property>
+ <property name="title">
+ <string>NFS Options</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout6</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>publicNFSChk</cstring>
+ </property>
+ <property name="text">
+ <string>Pu&amp;blic</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>writableNFSChk</cstring>
+ </property>
+ <property name="text">
+ <string>W&amp;ritable</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer5</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout4</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>moreNFSBtn</cstring>
+ </property>
+ <property name="text">
+ <string>More NFS Op&amp;tions</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>156</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>sambaChk</cstring>
+ </property>
+ <property name="text">
+ <string>Share with S&amp;amba (Microsoft(R) Windows(R))</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>sambaGrp</cstring>
+ </property>
+ <property name="title">
+ <string>Samba Options</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout3</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Name:</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit">
+ <property name="name">
+ <cstring>sambaNameEdit</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout5</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>publicSambaChk</cstring>
+ </property>
+ <property name="text">
+ <string>P&amp;ublic</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>writableSambaChk</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Writable</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer4_3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout3</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>moreSambaBtn</cstring>
+ </property>
+ <property name="text">
+ <string>Mor&amp;e Samba Options</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer4_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>1</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>sambaChk</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>sambaGrp</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>nfsChk</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>nfsGrp</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>publicSambaChk</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>writableSambaChk</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>publicNFSChk</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>writableNFSChk</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>shareChk</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>shareFrame</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>shareChk</sender>
+ <signal>clicked()</signal>
+ <receiver>PropertiesPageGUI</receiver>
+ <slot>changedSlot()</slot>
+ </connection>
+ <connection>
+ <sender>sambaChk</sender>
+ <signal>clicked()</signal>
+ <receiver>PropertiesPageGUI</receiver>
+ <slot>changedSlot()</slot>
+ </connection>
+ <connection>
+ <sender>publicSambaChk</sender>
+ <signal>clicked()</signal>
+ <receiver>PropertiesPageGUI</receiver>
+ <slot>changedSlot()</slot>
+ </connection>
+ <connection>
+ <sender>writableSambaChk</sender>
+ <signal>clicked()</signal>
+ <receiver>PropertiesPageGUI</receiver>
+ <slot>changedSlot()</slot>
+ </connection>
+ <connection>
+ <sender>nfsChk</sender>
+ <signal>clicked()</signal>
+ <receiver>PropertiesPageGUI</receiver>
+ <slot>changedSlot()</slot>
+ </connection>
+ <connection>
+ <sender>publicNFSChk</sender>
+ <signal>clicked()</signal>
+ <receiver>PropertiesPageGUI</receiver>
+ <slot>changedSlot()</slot>
+ </connection>
+ <connection>
+ <sender>writableNFSChk</sender>
+ <signal>clicked()</signal>
+ <receiver>PropertiesPageGUI</receiver>
+ <slot>changedSlot()</slot>
+ </connection>
+ <connection>
+ <sender>moreNFSBtn</sender>
+ <signal>clicked()</signal>
+ <receiver>PropertiesPageGUI</receiver>
+ <slot>moreNFSBtn_clicked()</slot>
+ </connection>
+ <connection>
+ <sender>sambaChk</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>PropertiesPageGUI</receiver>
+ <slot>sambaChkToggled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>sambaNameEdit</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>PropertiesPageGUI</receiver>
+ <slot>changedSlot()</slot>
+ </connection>
+ <connection>
+ <sender>publicSambaChk</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>PropertiesPageGUI</receiver>
+ <slot>publicSambaChkToggled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>publicNFSChk</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>PropertiesPageGUI</receiver>
+ <slot>publicNFSChkToggled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>moreSambaBtn</sender>
+ <signal>clicked()</signal>
+ <receiver>PropertiesPageGUI</receiver>
+ <slot>moreSambaBtnClicked()</slot>
+ </connection>
+</connections>
+<includes>
+ <include location="local" impldecl="in implementation">propertiespagegui.ui.h</include>
+</includes>
+<variables>
+ <variable>bool m_hasChanged;</variable>
+</variables>
+<signals>
+ <signal>changed()</signal>
+</signals>
+<slots>
+ <slot access="protected">changedSlot()</slot>
+ <slot>moreNFSBtn_clicked()</slot>
+ <slot>sambaChkToggled( bool )</slot>
+ <slot>publicSambaChkToggled( bool b )</slot>
+ <slot>publicNFSChkToggled( bool b )</slot>
+ <slot>moreSambaBtnClicked()</slot>
+</slots>
+<functions>
+ <function returnType="bool">hasChanged()</function>
+</functions>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/filesharing/advanced/propsdlgplugin/propertiespagegui.ui.h b/filesharing/advanced/propsdlgplugin/propertiespagegui.ui.h
new file mode 100644
index 00000000..89d4a56e
--- /dev/null
+++ b/filesharing/advanced/propsdlgplugin/propertiespagegui.ui.h
@@ -0,0 +1,56 @@
+/****************************************************************************
+** ui.h extension file, included from the uic-generated form implementation.
+**
+** If you wish to add, delete or rename functions or slots use
+** Qt Designer which will update this file, preserving your code. Create an
+** init() function in place of a constructor, and a destroy() function in
+** place of a destructor.
+*****************************************************************************/
+
+
+void PropertiesPageGUI::changedSlot()
+{
+ m_hasChanged = true;
+ emit changed();
+}
+
+
+void PropertiesPageGUI::moreNFSBtn_clicked()
+{
+
+}
+
+
+bool PropertiesPageGUI::hasChanged()
+{
+ return m_hasChanged;
+}
+
+
+void PropertiesPageGUI::sambaChkToggled( bool )
+{
+
+}
+
+
+void PropertiesPageGUI::publicSambaChkToggled( bool b)
+{
+ if (!b) {
+ writableSambaChk->setChecked(false);
+ }
+}
+
+
+void PropertiesPageGUI::publicNFSChkToggled( bool b)
+{
+ if (!b) {
+ writableNFSChk->setChecked(false);
+ }
+
+}
+
+
+void PropertiesPageGUI::moreSambaBtnClicked()
+{
+
+}
diff --git a/filesharing/advanced/propsdlgplugin/propsdlgshareplugin.cpp b/filesharing/advanced/propsdlgplugin/propsdlgshareplugin.cpp
new file mode 100644
index 00000000..70d94519
--- /dev/null
+++ b/filesharing/advanced/propsdlgplugin/propsdlgshareplugin.cpp
@@ -0,0 +1,126 @@
+/*
+ Copyright (c) 2004 Jan Schaefer <j_schaef@informatik.uni-kl.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 <qstring.h>
+#include <qvbox.h>
+#include <qlayout.h>
+#include <qlabel.h>
+
+#include <kgenericfactory.h>
+#include <kdebug.h>
+#include <kpushbutton.h>
+#include <kfileshare.h>
+#include <kmessagebox.h>
+#include <kprocess.h>
+#include <kstandarddirs.h>
+#include <kdialog.h>
+#include <kglobal.h>
+
+#include "propertiespage.h"
+#include "propsdlgshareplugin.h"
+
+typedef KGenericFactory<PropsDlgSharePlugin, KPropertiesDialog> PropsDlgSharePluginFactory;
+
+K_EXPORT_COMPONENT_FACTORY( fileshare_propsdlgplugin,
+ PropsDlgSharePluginFactory("fileshare_propsdlgplugin") )
+
+class PropsDlgSharePlugin::Private
+{
+ public:
+ PropertiesPage* page;
+};
+
+PropsDlgSharePlugin::PropsDlgSharePlugin( KPropertiesDialog *dlg,
+ const char *, const QStringList & )
+ : KPropsDlgPlugin(dlg), d(0)
+{
+ KGlobal::locale()->insertCatalogue("kfileshare");
+
+ if (KFileShare::shareMode() == KFileShare::Simple) {
+ kdDebug(5009) << "PropsDlgSharePlugin: Sharing mode is simple. Aborting." << endl;
+ return;
+ }
+
+
+ QVBox* vbox = properties->addVBoxPage(i18n("&Share"));
+ properties->setFileSharingPage(vbox);
+
+ if (KFileShare::authorization() == KFileShare::UserNotAllowed) {
+
+ QWidget* widget = new QWidget( vbox );
+ QVBoxLayout * vLayout = new QVBoxLayout( widget );
+ vLayout->setSpacing( KDialog::spacingHint() );
+ vLayout->setMargin( 0 );
+
+
+ if (KFileShare::sharingEnabled()) {
+ vLayout->addWidget(
+ new QLabel( i18n("You need to be authorized to share directories."),
+ widget ));
+ } else {
+ vLayout->addWidget(
+ new QLabel( i18n("File sharing is disabled."), widget));
+ }
+
+ KPushButton* btn = new KPushButton( i18n("Configure File Sharing..."), widget );
+ connect( btn, SIGNAL( clicked() ), SLOT( slotConfigureFileSharing() ) );
+ btn->setDefault(false);
+ QHBoxLayout* hBox = new QHBoxLayout( (QWidget *)0L );
+ hBox->addWidget( btn, 0, Qt::AlignLeft );
+ vLayout->addLayout(hBox);
+ vLayout->addStretch( 10 ); // align items on top
+ return;
+ }
+
+
+ d = new Private();
+
+ d->page = new PropertiesPage(vbox, properties->items(),false);
+ connect(d->page, SIGNAL(changed()),
+ this, SIGNAL(changed()));
+
+ kdDebug(5009) << "Fileshare properties dialog plugin loaded" << endl;
+
+}
+
+void PropsDlgSharePlugin::slotConfigureFileSharing()
+{
+ KProcess proc;
+ proc << KStandardDirs::findExe("kdesu") << locate("exe", "kcmshell") << "fileshare";
+ proc.start( KProcess::DontCare );
+}
+
+
+PropsDlgSharePlugin::~PropsDlgSharePlugin()
+{
+ delete d;
+}
+
+void PropsDlgSharePlugin::applyChanges()
+{
+ if (!d->page->save()) {
+// KMessageBox::sorry(d->page,
+// i18n("Saving the changes failed"));
+
+ properties->abortApplying();
+ }
+}
+
+
+#include "propsdlgshareplugin.moc"
+
diff --git a/filesharing/advanced/propsdlgplugin/propsdlgshareplugin.h b/filesharing/advanced/propsdlgplugin/propsdlgshareplugin.h
new file mode 100644
index 00000000..acf889fa
--- /dev/null
+++ b/filesharing/advanced/propsdlgplugin/propsdlgshareplugin.h
@@ -0,0 +1,44 @@
+/*
+ Copyright (c) 2004 Jan Schaefer <j_schaef@informatik.uni-kl.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.
+
+*/
+
+#ifndef KONQFILESHAREPLUGIN_H
+#define KONQFILESHAREPLUGIN_H
+
+#include <kpropertiesdialog.h>
+
+class PropsDlgSharePlugin : public KPropsDlgPlugin
+{
+Q_OBJECT
+public:
+ PropsDlgSharePlugin( KPropertiesDialog *dlg, const char *, const QStringList & );
+ virtual ~PropsDlgSharePlugin();
+ virtual void applyChanges();
+
+protected slots:
+ void slotConfigureFileSharing();
+
+private:
+ class Private;
+ Private *d;
+
+};
+
+#endif
+
+