OSSP CVS Repository

ossp - Difference in ossp-pkg/as/as-gui/as_assist.cpp versions 1.70 and 1.71
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/as/as-gui/as_assist.cpp 1.70 -> 1.71

--- as_assist.cpp        2002/12/16 12:11:40     1.70
+++ as_assist.cpp        2002/12/16 14:07:59     1.71
@@ -33,6 +33,7 @@
 #if defined(Q_OS_WIN32)
 #include <lmcons.h>
 #else
+#include <pwd.h>
 #include <unistd.h>
 #endif // #if defined(Q_OS_WIN32)
 
@@ -79,7 +80,7 @@
 //
 void Titraqform::setupPrefs(void)
 {
-    QString Username;
+    QString Username, Homedir;
 
 // Start the show by getting the username
 #if defined(Q_OS_WIN32)
@@ -89,24 +90,36 @@
         TCHAR szWinusername[UNLEN + 1];   // UNLEN is defined in lmcons.h
         GetUserName(szWinusername, &dwWinusernamesize);
         Username = qt_winQString(szWinusername);
-#else   // not unicode
+#else   // Not unicode
         char szWinusername[UNLEN + 1];    // UNLEN is defined in lmcons.h
         GetUserNameA(szWinusername, &dwWinusernamesize);
         Username = QString::fromLocal8Bit(szWinusername);
     }
 #endif  // #if defined(UNICODE)
-#else   // not windows
+#else   // Not windows
     {
 //#include <stdio.h>
 //        char *szUser = NULL;
 //        szUser = cuserid();
 //        Username = QString::fromLocal8Bit(szUser);
-        Username = QString::fromLocal8Bit(getlogin());
+        char *szLogin = getlogin();
+        passwd *pUserpwd = getpwnam(szLogin);
+
+        Homedir = QString::fromLocal8Bit(pUserpwd->pw_dir);
+        Username = QString::fromLocal8Bit(szLogin);
     }
 #endif  // #if defined(Q_OS_WIN32)
 
-    m_pPrefs = new Preferences(TITRAQ_PREFNAME, TITRAQ_APPTITLE, TITRAQ_PREFVER);
+    // Bootstrap a user preferences object from operating system info
+    m_pPrefs = new Preferences(Homedir + QChar('/') +
+                               QString::fromLocal8Bit(TITRAQ_PREFNAME),
+                               QString::fromLocal8Bit(TITRAQ_APPTITLE),
+                               QString::fromLocal8Bit(TITRAQ_PREFVER));
     if (!m_pPrefs->fileState()) {   // No file was found, so assume a null state
+        if (!Homedir.isEmpty())
+            m_pPrefs->setString(TITRAQ_PREFHOME, Homedir);
+        else
+            m_pPrefs->setString(TITRAQ_PREFHOME, TITRAQ_DEFUSER);
         if (!Username.isEmpty())
             m_pPrefs->setString(TITRAQ_PREFUSER, Username);
         else
@@ -119,7 +132,7 @@
         m_pPrefs->setString(TITRAQ_PREFLOCALLOG, TITRAQ_DEFLOCALLOG);
         m_pPrefs->flush();  // Write the new conf file
         QTextStream cerr(stderr, IO_WriteOnly);
-        cerr << trUtf8("Created new preferences file ./") << trUtf8(TITRAQ_PREFNAME) << endl;
+        cerr << trUtf8("Created new preferences file ") << Homedir + QChar('/') + QString::fromLocal8Bit(TITRAQ_PREFNAME) << endl;
     }
 
     // Use the preferred configuration values to initialize titraq
@@ -536,6 +549,7 @@
     connect(m_pMaintable, SIGNAL(doubleClicked(int, int, int, const QPoint&)), this, SLOT(inplaceEdit(int, int, int, const QPoint&)));
     connect(m_pTablehead, SIGNAL(sizeChange(int, int, int)), this, SLOT(updSizes(int, int, int)));
     connect(m_pMaintable, SIGNAL(valueChanged(int, int)), this, SLOT(dataChanged(void)));
+    connect(m_pMaintable, SIGNAL(valueChanged(int, int)), this, SLOT(validateData(int, int)));
     connect(m_pMaintable, SIGNAL(textEdited(void)), this, SLOT(dataChanged(void)));
 }
 

CVSTrac 2.0.1