diff options
author | Robert Xu <robxu9@gmail.com> | 2011-11-10 18:04:39 -0500 |
---|---|---|
committer | Robert Xu <robxu9@gmail.com> | 2011-11-10 18:04:39 -0500 |
commit | 21fcfa3348213aa87f0e3aef62ca4720c6d31cb7 (patch) | |
tree | 2cfb64c59322628e613ed0895e3c3694d3abe6bd /opensuse/core/tdelibs/disable-samba-dialog-without-smb.diff | |
parent | 8667643bff14a60d8571c599efd3e48bed3e3b12 (diff) | |
download | tde-packaging-21fcfa3348213aa87f0e3aef62ca4720c6d31cb7.tar.gz tde-packaging-21fcfa3348213aa87f0e3aef62ca4720c6d31cb7.zip |
initial commit to suse branch: eclipse integration
Diffstat (limited to 'opensuse/core/tdelibs/disable-samba-dialog-without-smb.diff')
-rw-r--r-- | opensuse/core/tdelibs/disable-samba-dialog-without-smb.diff | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/opensuse/core/tdelibs/disable-samba-dialog-without-smb.diff b/opensuse/core/tdelibs/disable-samba-dialog-without-smb.diff new file mode 100644 index 000000000..cd0c29927 --- /dev/null +++ b/opensuse/core/tdelibs/disable-samba-dialog-without-smb.diff @@ -0,0 +1,66 @@ +Index: kio/kio/kfileshare.cpp +=================================================================== +--- kio/kio/kfileshare.cpp.orig ++++ kio/kio/kfileshare.cpp +@@ -291,4 +291,24 @@ bool KFileShare::setShared( const QStrin + return ok; + } + ++bool KFileShare::sambaActive() ++{ ++ // rcsmb is not executable by users, try ourselves ++ int status = system( "/sbin/checkproc -p /var/run/samba/smbd.pid /usr/sbin/smbd" ); ++ return status != -1 && WIFEXITED( status ) && WEXITSTATUS( status ) == 0; ++} ++ ++bool KFileShare::nfsActive() ++{ ++ // rcnfsserver is not executable by users, try ourselves ++ int status = system( "/sbin/checkproc /usr/sbin/rpc.mountd" ); ++ if( status != -1 && WIFEXITED( status ) && WEXITSTATUS( status ) == 0 ) ++ { ++ status = system( "/sbin/checkproc -n nfsd" ); ++ if( status != -1 && WIFEXITED( status ) && WEXITSTATUS( status ) == 0 ) ++ return true; ++ } ++ return false; ++} ++ + #include "kfileshare.moc" +Index: kio/kio/kfileshare.h +=================================================================== +--- kio/kio/kfileshare.h.orig ++++ kio/kio/kfileshare.h +@@ -131,6 +131,18 @@ public: + * Returns whether NFS is enabled + */ + static bool nfsEnabled(); ++ ++ /** ++ * Returns whether Samba is active (service is running) ++ * @internal ++ */ ++ static bool sambaActive(); ++ ++ /** ++ * Returns whether NFS is active (service is running) ++ * @internal ++ */ ++ static bool nfsActive(); + + private: + static Authorization s_authorization; +Index: kio/kfile/kfilesharedlg.cpp +=================================================================== +--- kio/kfile/kfilesharedlg.cpp.orig ++++ kio/kfile/kfilesharedlg.cpp +@@ -167,6 +167,9 @@ void KFileSharePropsPlugin::init() + vbox->addWidget( m_pbConfig, 0, Qt::AlignHCenter ); + + vbox->addStretch( 10 ); ++ ++ if( !KFileShare::sambaActive() && !KFileShare::nfsActive()) ++ m_widget->setEnabled( false ); + } + } + break; |