[rkward-cvs] rkward/rkward/dialogs rkloadlibsdialog.cpp, 1.25, 1.26 rkloadlibsdialog.h, 1.11, 1.12

Thomas Friedrichsmeier tfry at users.sourceforge.net
Sun Sep 10 23:02:04 UTC 2006


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

Modified Files:
	rkloadlibsdialog.cpp rkloadlibsdialog.h 
Log Message:
Installation of a required () package is automated some more

Index: rkloadlibsdialog.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/dialogs/rkloadlibsdialog.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** rkloadlibsdialog.cpp	10 Sep 2006 20:47:28 -0000	1.25
--- rkloadlibsdialog.cpp	10 Sep 2006 23:02:02 -0000	1.26
***************
*** 25,28 ****
--- 25,29 ----
  #include <qdir.h>
  #include <qregexp.h>
+ #include <qtimer.h>
  
  #include <klocale.h>
***************
*** 54,58 ****
  	page = addPage (i18n ("Install"));
  	layout = new QVBoxLayout (page, 0, KDialog::spacingHint ());
! 	layout->addWidget (new InstallPackagesWidget (this, page));
  
  	setButtonText (KDialogBase::User1, i18n ("Configure Repositories"));
--- 55,59 ----
  	page = addPage (i18n ("Install"));
  	layout = new QVBoxLayout (page, 0, KDialog::spacingHint ());
! 	layout->addWidget (install_packages_widget = new InstallPackagesWidget (this, page));
  
  	setButtonText (KDialogBase::User1, i18n ("Configure Repositories"));
***************
*** 72,79 ****
  
  //static
! void RKLoadLibsDialog::showInstallPackagesModal (QWidget *parent, RCommandChain *chain) {
  	RK_TRACE (DIALOGS);
  
  	RKLoadLibsDialog *dialog = new RKLoadLibsDialog (parent, chain, true);
  	dialog->showPage (2);
  	dialog->exec ();
--- 73,82 ----
  
  //static
! void RKLoadLibsDialog::showInstallPackagesModal (QWidget *parent, RCommandChain *chain, const QString &package_name) {
  	RK_TRACE (DIALOGS);
  
  	RKLoadLibsDialog *dialog = new RKLoadLibsDialog (parent, chain, true);
+ 	dialog->auto_install_package = package_name;
+ 	QTimer::singleShot (0, dialog, SLOT (automatedInstall ()));		// to get past the dialog->exec, below
  	dialog->showPage (2);
  	dialog->exec ();
***************
*** 81,84 ****
--- 84,94 ----
  }
  
+ void RKLoadLibsDialog::automatedInstall () {
+ 	RK_TRACE (DIALOGS);
+ 
+ 	install_packages_widget->getListButtonClicked ();
+ 	install_packages_widget->trySelectPackage (auto_install_package);
+ }
+ 
  void RKLoadLibsDialog::tryDestruct () {
  	RK_TRACE (DIALOGS);
***************
*** 212,216 ****
  	
  	QVBoxLayout *mvbox = new QVBoxLayout (this, 0, KDialog::spacingHint ());
! 	QLabel *label = new QLabel (i18n ("There are no safeguards against removing essential packages. For example, unloading \"rkward\" will prevent this application from running properly. Please, be careful about the packages you unload."), this);
  	label->setAlignment (Qt::AlignAuto | Qt::AlignVCenter | Qt::ExpandTabs | Qt::WordBreak);
  	mvbox->addWidget (label);
--- 222,226 ----
  	
  	QVBoxLayout *mvbox = new QVBoxLayout (this, 0, KDialog::spacingHint ());
! 	QLabel *label = new QLabel (i18n ("There are no safeguards against removing essential packages. For example, unloading \"rkward\" will prevent this application from running properly. Please be careful about the packages you unload."), this);
  	label->setAlignment (Qt::AlignAuto | Qt::AlignVCenter | Qt::ExpandTabs | Qt::WordBreak);
  	mvbox->addWidget (label);
***************
*** 512,516 ****
  	RCommand *command = new RCommand ("c (.rk.get.old.packages (), rk.make.repos.string ())", RCommand::App | RCommand::GetStringVector, QString::null, this, FIND_OLD_PACKAGES_COMMAND);
  
! 	RKProgressControl *control = new RKProgressControl (this, i18n ("Please, stand by while downloading the list packages with updates available."), i18n ("Fetching list"), RKProgressControl::CancellableProgress | RKProgressControl::AutoCancelCommands);
  	control->addRCommand (command, true);
  	RKGlobals::rInterface ()->issueCommand (command, parent->chain);
--- 522,526 ----
  	RCommand *command = new RCommand ("c (.rk.get.old.packages (), rk.make.repos.string ())", RCommand::App | RCommand::GetStringVector, QString::null, this, FIND_OLD_PACKAGES_COMMAND);
  
! 	RKProgressControl *control = new RKProgressControl (this, i18n ("Please stand by while determining, which package have an update available online."), i18n ("Fetching list"), RKProgressControl::CancellableProgress | RKProgressControl::AutoCancelCommands);
  	control->addRCommand (command, true);
  	RKGlobals::rInterface ()->issueCommand (command, parent->chain);
***************
*** 633,637 ****
  
  	RCommand *command = new RCommand ("c (.rk.get.available.packages (), rk.make.repos.string ())", RCommand::App | RCommand::GetStringVector, QString::null, this, FIND_AVAILABLE_PACKAGES_COMMAND);
! 	RKProgressControl *control = new RKProgressControl (this, i18n ("Please, stand by while downloading the list available packages."), i18n ("Fetching list"), RKProgressControl::CancellableProgress | RKProgressControl::AutoCancelCommands);
  	control->addRCommand (command, true);
  	RKGlobals::rInterface ()->issueCommand (command, parent->chain);
--- 643,647 ----
  
  	RCommand *command = new RCommand ("c (.rk.get.available.packages (), rk.make.repos.string ())", RCommand::App | RCommand::GetStringVector, QString::null, this, FIND_AVAILABLE_PACKAGES_COMMAND);
! 	RKProgressControl *control = new RKProgressControl (this, i18n ("Please stand by while downloading the list of available packages."), i18n ("Fetching list"), RKProgressControl::CancellableProgress | RKProgressControl::AutoCancelCommands);
  	control->addRCommand (command, true);
  	RKGlobals::rInterface ()->issueCommand (command, parent->chain);
***************
*** 639,642 ****
--- 649,670 ----
  }
  
+ void InstallPackagesWidget::trySelectPackage (const QString &package_name) {
+ 	RK_TRACE (DIALOGS);
+ 
+ 	bool found = false;
+ 	for (QListViewItem *item = installable_view->firstChild (); item; item = item->nextSibling ()) {
+ 		if (item->text (0) == package_name) {
+ 			found = true;
+ 			item->setSelected (true);
+ 			installable_view->ensureItemVisible (item);
+ 			break;
+ 		}
+ 	}
+ 
+ 	if (!found) {
+ 		KMessageBox::sorry (0, i18n ("The package requested by the backend (\"%1\") was not found in the package repositories. Maybe the package name was mis-spelled. Or maybe you need to add additional repositories via the \"Configure Repositories\"-button.").arg (package_name), i18n ("Package not available"));
+ 	}
+ }
+ 
  void InstallPackagesWidget::ok () {
  	RK_TRACE (DIALOGS);

Index: rkloadlibsdialog.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/dialogs/rkloadlibsdialog.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** rkloadlibsdialog.h	10 Sep 2006 20:13:17 -0000	1.11
--- rkloadlibsdialog.h	10 Sep 2006 23:02:02 -0000	1.12
***************
*** 35,38 ****
--- 35,39 ----
  class KProcess;
  class PackageInstallParamsWidget;
+ class InstallPackagesWidget;
  
  /**
***************
*** 53,58 ****
  	bool installPackages (const QStringList &packages, const QString &to_libloc, bool install_dependencies, bool as_root);
  
! 	/** opens a modal RKLoadLibsDialog with the "Install new Packages" tab on front (To be used when a require () fails in the R backend */
! 	static void showInstallPackagesModal (QWidget *parent, RCommandChain *chain);
  signals:
  	void downloadComplete ();
--- 54,62 ----
  	bool installPackages (const QStringList &packages, const QString &to_libloc, bool install_dependencies, bool as_root);
  
! /** opens a modal RKLoadLibsDialog with the "Install new Packages" tab on front (To be used when a require () fails in the R backend
! @param parent parent QWidget. The dialog will be centered there
! @param chain RCommandChain to run the necessary commands in
! @param package_name name of the required package */
! 	static void showInstallPackagesModal (QWidget *parent, RCommandChain *chain, const QString &package_name);
  signals:
  	void downloadComplete ();
***************
*** 74,77 ****
--- 78,82 ----
  	void installationProcessOutput (KProcess *proc, char *buffer, int buflen);
  	void installationProcessError (KProcess *proc, char *buffer, int buflen);
+ 	void automatedInstall ();
  private:
  	void tryDestruct ();
***************
*** 80,83 ****
--- 85,92 ----
  friend class InstallPackagesWidget;
  	RCommandChain *chain;
+ 
+ 	InstallPackagesWidget *install_packages_widget;	// needed for automated installation
+ 
+ 	QString auto_install_package;
  	int num_child_widgets;
  	bool accepted;
***************
*** 167,170 ****
--- 176,180 ----
  	
  	~InstallPackagesWidget ();
+ 	void trySelectPackage (const QString &package_name);
  public slots:
  	void installSelectedButtonClicked ();





More information about the rkward-tracker mailing list