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