[rkward-cvs] rkward/rkward/dialogs rkloadlibsdialog.cpp,1.11,1.12 rkloadlibsdialog.h,1.4,1.5

Thomas Friedrichsmeier tfry at users.sourceforge.net
Sun Sep 18 15:17:55 UTC 2005


Update of /cvsroot/rkward/rkward/rkward/dialogs
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29681/rkward/dialogs

Modified Files:
	rkloadlibsdialog.cpp rkloadlibsdialog.h 
Log Message:
downloaded packages are now archived or deleted according to user setting. Ability to specify additional package repositories

Index: rkloadlibsdialog.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/dialogs/rkloadlibsdialog.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** rkloadlibsdialog.cpp	28 Apr 2005 22:27:59 -0000	1.11
--- rkloadlibsdialog.cpp	18 Sep 2005 15:17:52 -0000	1.12
***************
*** 32,35 ****
--- 32,36 ----
  #include "../rbackend/rinterface.h"
  #include "../settings/rksettingsmodulelogfiles.h"
+ #include "../settings/rksettings.h"
  #include "../misc/rkerrordialog.h"
  #include "../misc/rkcanceldialog.h"
***************
*** 39,43 ****
  #define DOWNLOAD_PACKAGES_COMMAND 1
  
! RKLoadLibsDialog::RKLoadLibsDialog (QWidget *parent, RCommandChain *chain, bool modal) : KDialogBase (KDialogBase::Tabbed, Qt::WStyle_DialogBorder, parent, 0, modal, i18n ("Configure Packages")) {
  	RK_TRACE (DIALOGS);
  	RKLoadLibsDialog::chain = chain;
--- 40,44 ----
  #define DOWNLOAD_PACKAGES_COMMAND 1
  
! RKLoadLibsDialog::RKLoadLibsDialog (QWidget *parent, RCommandChain *chain, bool modal) : KDialogBase (KDialogBase::Tabbed, Qt::WStyle_DialogBorder, parent, 0, modal, i18n ("Configure Packages"), KDialogBase::Ok | KDialogBase::Apply | KDialogBase::Cancel | KDialogBase::User1) {
  	RK_TRACE (DIALOGS);
  	RKLoadLibsDialog::chain = chain;
***************
*** 57,60 ****
--- 58,63 ----
  	error_dialog = new RKErrorDialog (i18n ("The R-backend has reported errors handling packages.\nA transcript of the errors are shown below."), i18n ("Error handling packages"), false);
  
+ 	setButtonText (KDialogBase::User1, i18n ("Configure Repositories"));
+ 
  	num_child_widgets = 3;
  	accepted = false;
***************
*** 115,118 ****
--- 118,127 ----
  }
  
+ void RKLoadLibsDialog::slotUser1 () {
+ 	RK_TRACE (DIALOGS);
+ 
+ 	RKSettings::configureSettings (RKSettings::R, this, chain);
+ }
+ 
  void RKLoadLibsDialog::closeEvent (QCloseEvent *e) {
  	RK_TRACE (DIALOGS);
***************
*** 131,139 ****
  }
  
! bool RKLoadLibsDialog::downloadPackages (const QStringList &packages, QString to_dir) {
  	RK_TRACE (DIALOGS);
! 	if (to_dir == "") {
! 		to_dir = QDir (RKSettingsModuleLogfiles::filesPath ()).filePath (".packagetemp");
! 	}
  	if (packages.isEmpty ()) return false;
  	
--- 140,148 ----
  }
  
! bool RKLoadLibsDialog::downloadPackages (const QStringList &packages) {
  	RK_TRACE (DIALOGS);
! 
! 	QString to_dir = QDir (RKSettingsModuleLogfiles::filesPath ()).filePath (".packagetemp");
! 
  	if (packages.isEmpty ()) return false;
  	
***************
*** 146,157 ****
  }
  
! void RKLoadLibsDialog::installDownloadedPackages (bool become_root, QString dir) {
  	RK_TRACE (DIALOGS);
! 	QDir tempdir;
! 	if (dir == "") {
! 		tempdir = QDir (RKSettingsModuleLogfiles::filesPath ()).filePath (".packagetemp");
! 	} else {
! 		tempdir = dir;
! 	}
  	tempdir.setFilter (QDir::Files);
  	
--- 155,162 ----
  }
  
! void RKLoadLibsDialog::installDownloadedPackages (bool become_root) {
  	RK_TRACE (DIALOGS);
! 	QDir tempdir = QDir (RKSettingsModuleLogfiles::filesPath ()).filePath (".packagetemp");
! 
  	tempdir.setFilter (QDir::Files);
  	
***************
*** 174,177 ****
--- 179,207 ----
  	}
  	delete proc;
+ 
+ 	// archive / delete packages
+ 	bool ok = true;
+ 	if (RKSettingsModuleR::archivePackages ()) {
+ 		// step 1: create archive-dir, if neccessary
+ 		QDir archivedir = QDir (RKSettingsModuleLogfiles::filesPath ()).filePath ("package_archive");
+ 		if (!archivedir.exists ()) {
+ 			QDir (RKSettingsModuleLogfiles::filesPath ()).mkdir ("package_archive");
+ 		} if (!archivedir.isReadable ()) {
+ 			RK_DO (qDebug ("Directory '%s' could not be created or is not readable", archivedir.absPath ().latin1 ()), DIALOGS, DL_ERROR);
+ 			return;
+ 		}
+ 
+ 		for (unsigned int i=0; i < tempdir.count (); ++i) {
+ 			if (!tempdir.rename (tempdir[i].latin1 (), archivedir.absFilePath (tempdir[i].latin1 ()))) ok = false;
+ 		}
+ 	} else {
+ 		for (unsigned int i=0; i < tempdir.count (); ++i) {
+ 			if (!QFile (tempdir.filePath (tempdir[i]).latin1 ()).remove ()) ok = false;
+ 		}
+ 	}
+ 
+ 	if (!ok) {
+ 		RK_DO (qDebug ("One or more package files could not be moved/delted"), DIALOGS, DL_ERROR);
+ 	}
  }
  
***************
*** 370,374 ****
  	
  	QVBoxLayout *mvbox = new QVBoxLayout (this, 0, KDialog::spacingHint ());
! 	QLabel *label = new QLabel (i18n ("Local packages could be updated with their latest versions from CRAN (Comprehensive R Archive Network). This feature require a working network connection to Internet."), this);
  	label->setAlignment (Qt::AlignAuto | Qt::AlignVCenter | Qt::ExpandTabs | Qt::WordBreak);
  	mvbox->addWidget (label);
--- 400,404 ----
  	
  	QVBoxLayout *mvbox = new QVBoxLayout (this, 0, KDialog::spacingHint ());
! 	QLabel *label = new QLabel (i18n ("In order to find out, which of your installed packaged have an update available, click \"Fetch List\". This feature requires a working internet connection."), this);
  	label->setAlignment (Qt::AlignAuto | Qt::AlignVCenter | Qt::ExpandTabs | Qt::WordBreak);
  	mvbox->addWidget (label);
***************
*** 499,503 ****
  	
  	QVBoxLayout *mvbox = new QVBoxLayout (this, 0, KDialog::spacingHint ());
! 	QLabel *label = new QLabel (i18n ("Many packages are available on CRAN (Comprehensive R Archive Network) and you could fetch the list with a working network connection to Internet."), this);
  	label->setAlignment (Qt::AlignAuto | Qt::AlignVCenter | Qt::ExpandTabs | Qt::WordBreak);
  	mvbox->addWidget (label);
--- 529,533 ----
  	
  	QVBoxLayout *mvbox = new QVBoxLayout (this, 0, KDialog::spacingHint ());
! 	QLabel *label = new QLabel (i18n ("Many packages are available on CRAN (Comprehensive R Archive Network), and other repositories (click \"Configure Repositories\" to add more sources). Click \"Fetch List\" to find out, which packages are available. This feature requires a working internet connection."), this);
  	label->setAlignment (Qt::AlignAuto | Qt::AlignVCenter | Qt::ExpandTabs | Qt::WordBreak);
  	mvbox->addWidget (label);

Index: rkloadlibsdialog.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/dialogs/rkloadlibsdialog.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** rkloadlibsdialog.h	9 Sep 2004 15:15:00 -0000	1.4
--- rkloadlibsdialog.h	18 Sep 2005 15:17:52 -0000	1.5
***************
*** 22,25 ****
--- 22,26 ----
  #include <qstringlist.h>
  
+ #include "../settings/rksettingsmoduler.h"
  #include "../rbackend/rcommandreceiver.h"
  
***************
*** 48,53 ****
  	~RKLoadLibsDialog ();
  	
! 	bool downloadPackages (const QStringList &packages, QString to_dir = QString::null);
! 	void installDownloadedPackages (bool become_root, QString dir = QString::null);
  
  	/** opens a modal RKLoadLibsDialog with the "Install new Packages" tab on front (To be used when a require () fails in the R backend */
--- 49,54 ----
  	~RKLoadLibsDialog ();
  	
! 	bool downloadPackages (const QStringList &packages);
! 	void installDownloadedPackages (bool become_root);
  
  	/** opens a modal RKLoadLibsDialog with the "Install new Packages" tab on front (To be used when a require () fails in the R backend */
***************
*** 63,66 ****
--- 64,69 ----
  	void slotApply ();
  	void slotCancel ();
+ /** User1-button was clicked, i.e.: "Configure Repositories" */
+ 	void slotUser1 ();
  	void childDeleted ();
  	void processExited (KProcess *);





More information about the rkward-tracker mailing list