[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    extragear/sysadmin/kiosktool
From:       Luboš Luňák <l.lunak () kde ! org>
Date:       2010-03-11 16:06:30
Message-ID: 1268323590.433250.1546.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1102017 by lunakl:

when running as non-root, actually also be able to save the profile config



 M  +0 -1      CMakeLists.txt  
 M  +20 -0     kconfigraweditor.cpp  
 M  +2 -1      kconfigraweditortest.cpp  


--- trunk/extragear/sysadmin/kiosktool/CMakeLists.txt #1102016:1102017
@@ -52,7 +52,6 @@
 
 set ( kconfigraweditor_SRCS
     kconfigraweditortest.cpp
-    kconfigraweditor.cpp
 )
 kde4_add_executable(kconfigraweditortest ${kconfigraweditor_SRCS})
 target_link_libraries(kconfigraweditortest ${KDE4_KDECORE_LIBS})
--- trunk/extragear/sysadmin/kiosktool/kconfigraweditor.cpp #1102016:1102017
@@ -3,6 +3,13 @@
 #include <QFile>
 #include <QTextStream>
 
+#include <krandom.h>
+#include <kstandarddirs.h>
+
+#ifndef KCONFIGRAWEDITORTEST
+#include "kioskrun.h"
+#endif
+
 KConfigRawEditor::KConfigEntryData::KConfigEntryData( const QString &_value, \
DataType _type )  {
     value = _value;
@@ -99,7 +106,13 @@
 
 bool KConfigRawEditor::save()
 {
+#ifdef KCONFIGRAWEDITORTEST
     QFile configFile( m_configFile );
+#else
+    QString localFile = ::KStandardDirs::locateLocal("tmp", \
"kiosktoolconfigfile_"+KRandom::randomString(5)); +    \
::unlink(QFile::encodeName(localFile)); +    QFile configFile( localFile );
+#endif
 
     if( configFile.open( QIODevice::WriteOnly ) )
     {
@@ -149,6 +162,13 @@
     else
 	return false;
 
+    configFile.close();
+#ifndef KCONFIGRAWEDITORTEST
+    // install the file to the right location with the right owner
+    if( !KioskRun::self()->install( localFile, m_configFile ))
+        return false;
+#endif
+
     return true;
 }
 
--- trunk/extragear/sysadmin/kiosktool/kconfigraweditortest.cpp #1102016:1102017
@@ -16,7 +16,8 @@
  *   Foundation, Inc., 51 Franklin Steet, Fifth Floor, Boston, MA  02111-1307, USA.
  */
 
- #include "kconfigraweditor.h"
+ #define KCONFIGRAWEDITORTEST
+ #include "kconfigraweditor.cpp"
 
  #include <qdebug.h>
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic