[PC-BSD Commits] r545 - pcbsd/trunk/kcmPBSystem

svn at pcbsd.org svn at pcbsd.org
Thu Jul 19 14:22:00 PDT 2007


Author: tim
Date: 2007-07-19 22:21:59 +0100 (Thu, 19 Jul 2007)
New Revision: 545

Modified:
   pcbsd/trunk/kcmPBSystem/cvsupprogress.ui.h
Log:
Added some error handling to cvsup, and fixed a couple of bugs.

Modified: pcbsd/trunk/kcmPBSystem/cvsupprogress.ui.h
===================================================================
--- pcbsd/trunk/kcmPBSystem/cvsupprogress.ui.h	2007-07-19 18:46:18 UTC (rev 544)
+++ pcbsd/trunk/kcmPBSystem/cvsupprogress.ui.h	2007-07-19 21:21:59 UTC (rev 545)
@@ -29,11 +29,11 @@
     outputBox->clear();
     cancelBut->setText(tr("&Cancel"));
     cvsup = new QProcess(this);
-    cvsup->addArgument("cvsup");
+    cvsup->addArgument("/usr/bin/csup");
     cvsup->addArgument(supfile);
     connect(cvsup, SIGNAL(readyReadStdout()), this, SLOT(displayOutput()));
     connect(cvsup, SIGNAL(processExited()), this, SLOT(cvsupFinished()));
-    cvsup->start();
+    if (!cvsup->start()) { KMessageBox::error(this, tr("Unable to execute command") + ": /usr/bin/csup " + supfile, tr("Error")); }
 }
 
 
@@ -67,7 +67,8 @@
     }
     else if (cancelBut->text() == tr("&Start"))
     {
-	start();
+	if (getServer() == "UNSET") { KMessageBox::information(this, tr("CVSup server not set. To set your CVSup server, please click the 'Find Fastest...' button and follow the instructions.\n\nAlternatively, the CVSup server for this operation may be set manually from the following file") + ":\n" + supfile, tr("Please set CVSup server before proceeding")); }
+	else { start(); }
 	return;
     }
     this->close();
@@ -94,11 +95,11 @@
 
 void CVSUpProgress::writeServer(QString server)
 {
-    QFile supfile(this->supfile);
+    QFile supRead(supfile);
     QStringList lines;
-    if (supfile.open(IO_ReadOnly))
+    if (supRead.open(IO_ReadOnly))
     {
-	QTextStream stream(&supfile);
+	QTextStream stream(&supRead);
 	QString line;
 	while (! stream.atEnd())
 	{
@@ -106,15 +107,16 @@
 	    if (line.contains("*default host=")) { lines += "*default host=" + server; }
 	    else { lines += line; }
 	}
+	supRead.close();
     }
-    supfile.close();
     
-    if (supfile.open(IO_ReadWrite))
+    QFile supWrite(supfile);
+    if (supWrite.open(IO_WriteOnly))
     {
-	QTextStream stream(&supfile);
+	QTextStream stream(&supWrite);
 	for ( QStringList::Iterator it = lines.begin(); it != lines.end(); ++it ) { stream << *it << "\n"; }
+	supWrite.close();
     }
-    supfile.close();
 }
 
 



More information about the Commits mailing list