|
|
|
@ -172,13 +172,13 @@ bool PropertiesPage::save() {
|
|
|
|
|
bool PropertiesPage::save(NFSFile* nfsFile, SambaFile* sambaFile, bool nfs, bool samba)
|
|
|
|
|
{
|
|
|
|
|
TQString nfsFileName = KNFSShare::instance()->exportsPath();
|
|
|
|
|
bool nfsNeedsKDEsu = false;
|
|
|
|
|
bool nfsNeedsTDEsu = false;
|
|
|
|
|
|
|
|
|
|
if (nfs) {
|
|
|
|
|
if (TQFileInfo(nfsFileName).isWritable()) {
|
|
|
|
|
nfsFile->saveTo(nfsFileName);
|
|
|
|
|
} else {
|
|
|
|
|
nfsNeedsKDEsu = true;
|
|
|
|
|
nfsNeedsTDEsu = true;
|
|
|
|
|
kdDebug(FILESHARE_DEBUG) << "PropertiesPage::save: nfs needs tdesu." << endl;
|
|
|
|
|
}
|
|
|
|
|
} else
|
|
|
|
@ -186,19 +186,19 @@ bool PropertiesPage::save(NFSFile* nfsFile, SambaFile* sambaFile, bool nfs, bool
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TQString sambaFileName = KSambaShare::instance()->smbConfPath();
|
|
|
|
|
bool sambaNeedsKDEsu = false;
|
|
|
|
|
bool sambaNeedsTDEsu = false;
|
|
|
|
|
if (samba) {
|
|
|
|
|
if (TQFileInfo(sambaFileName).isWritable()) {
|
|
|
|
|
sambaFile->saveTo(sambaFileName);
|
|
|
|
|
} else {
|
|
|
|
|
sambaNeedsKDEsu = true;
|
|
|
|
|
sambaNeedsTDEsu = true;
|
|
|
|
|
kdDebug(FILESHARE_DEBUG) << "PropertiesPage::save: samba needs tdesu." << endl;
|
|
|
|
|
}
|
|
|
|
|
} else
|
|
|
|
|
kdDebug(FILESHARE_DEBUG) << "PropertiesPage::save: samba has not changed." << endl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (nfsNeedsKDEsu || sambaNeedsKDEsu) {
|
|
|
|
|
if (nfsNeedsTDEsu || sambaNeedsTDEsu) {
|
|
|
|
|
KTempFile nfsTempFile;
|
|
|
|
|
nfsTempFile.setAutoDelete(true);
|
|
|
|
|
KTempFile sambaTempFile;
|
|
|
|
@ -208,14 +208,14 @@ bool PropertiesPage::save(NFSFile* nfsFile, SambaFile* sambaFile, bool nfs, bool
|
|
|
|
|
|
|
|
|
|
TQString command;
|
|
|
|
|
|
|
|
|
|
if (nfsNeedsKDEsu) {
|
|
|
|
|
if (nfsNeedsTDEsu) {
|
|
|
|
|
nfsFile->saveTo(nfsTempFile.name());
|
|
|
|
|
command += TQString("cp %1 %2;exportfs -ra;")
|
|
|
|
|
.arg(TDEProcess::quote( nfsTempFile.name() ))
|
|
|
|
|
.arg(TDEProcess::quote( nfsFileName ));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (sambaNeedsKDEsu) {
|
|
|
|
|
if (sambaNeedsTDEsu) {
|
|
|
|
|
sambaFile->saveTo(sambaTempFile.name());
|
|
|
|
|
command += TQString("cp %1 %2;")
|
|
|
|
|
.arg(TDEProcess::quote( sambaTempFile.name() ))
|
|
|
|
|