[PC-BSD Commits] r7997 - pcbsd/current/src-qt4/libpcbsd

svn at pcbsd.org svn at pcbsd.org
Sun Nov 7 12:46:26 PST 2010


Author: kris
Date: 2010-11-07 12:46:26 -0800 (Sun, 07 Nov 2010)
New Revision: 7997

Modified:
   pcbsd/current/src-qt4/libpcbsd/pcbsd-utils.h
   pcbsd/current/src-qt4/libpcbsd/utils.cpp
Log:

Added some new calls to libpcbsd to set / get vals from etc/pcbsd.conf



Modified: pcbsd/current/src-qt4/libpcbsd/pcbsd-utils.h
===================================================================
--- pcbsd/current/src-qt4/libpcbsd/pcbsd-utils.h	2010-11-07 20:37:37 UTC (rev 7996)
+++ pcbsd/current/src-qt4/libpcbsd/pcbsd-utils.h	2010-11-07 20:46:26 UTC (rev 7997)
@@ -32,6 +32,8 @@
    static long long sysctlAsInt(QString sysctl);
    static QString bytesToHumanReadable(long long bytes);
    static QString getValFromPBIConf(QString key);
+   static QString getValFromPCBSDConf(QString key);
+   static QString getValFromPCConf(QString conf, QString key);
    static QString getProxyURL();
    static QString getProxyUser();
    static QString getProxyPass();
@@ -39,6 +41,8 @@
    static QString getProxyPort();
    static QString getMasterMirror();
    static bool setValPBIConf(QString key, QString val);
+   static bool setValPCBSDConf(QString key, QString val);
+   static bool setValPCConf(QString conf, QString key, QString val);
    static bool setProxyURL(QString val);
    static bool setProxyUser(QString val);
    static bool setProxyPass(QString val);

Modified: pcbsd/current/src-qt4/libpcbsd/utils.cpp
===================================================================
--- pcbsd/current/src-qt4/libpcbsd/utils.cpp	2010-11-07 20:37:37 UTC (rev 7996)
+++ pcbsd/current/src-qt4/libpcbsd/utils.cpp	2010-11-07 20:46:26 UTC (rev 7997)
@@ -36,6 +36,7 @@
 
 // The default pbi.conf file
 QString PBI_ETCCONF(PREFIX + "/etc/pbi.conf");
+QString PCBSD_ETCCONF(PREFIX + "/etc/PCBSD.conf");
 
 QString Utils::sysctl(QString sysctl)
 {
@@ -85,9 +86,18 @@
 
 // Function to get a value from a specific key in the pbi.conf file
 QString Utils::getValFromPBIConf(QString key) {
+	return getValFromPCConf(PBI_ETCCONF, key);
+}
+
+// Function to get a value from a specific key in the pcbsd.conf file
+QString Utils::getValFromPCBSDConf(QString key) {
+	return getValFromPCConf(PCBSD_ETCCONF, key);
+}
+
+QString Utils::getValFromPCConf(QString conf, QString key) {
   
-  // Load from PBI_ETCCONF the default mirror
-  QFile confFile(PBI_ETCCONF);
+  // Load from conf the requested key
+  QFile confFile(conf);
   if ( confFile.open( QIODevice::ReadOnly ) ) {
         QTextStream stream( &confFile );
         stream.setCodec("UTF-8");
@@ -133,11 +143,21 @@
 
 bool Utils::setValPBIConf(QString key, QString val)
 {
+	return setValPCConf(PBI_ETCCONF, key, val);
+}
+
+bool Utils::setValPCBSDConf(QString key, QString val)
+{
+	return setValPCConf(PCBSD_ETCCONF, key, val);
+}
+
+bool Utils::setValPCConf(QString conf, QString key, QString val)
+{
   bool savedLine;
   QStringList pbiConf;
 
   // Read PBI_ETCCONF into memory
-  QFile confFile(PBI_ETCCONF);
+  QFile confFile(conf);
   if ( confFile.open( QIODevice::ReadOnly ) ) {
         QTextStream stream( &confFile );
         QString line;



More information about the Commits mailing list