[rkward-cvs] rkward/rkward/rbackend rinterface.cpp,1.45,1.46 rthread.cpp,1.34,1.35

Thomas Friedrichsmeier tfry at users.sourceforge.net
Sun Apr 16 23:01:24 UTC 2006


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

Modified Files:
	rinterface.cpp rthread.cpp 
Log Message:
Enhancements to readline () dialog:
Do not lock mutex, so X11 events can be processed
Allow empty input
Pressing Cancel will interrupt the current command

Index: rinterface.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rbackend/rinterface.cpp,v
retrieving revision 1.45
retrieving revision 1.46
diff -C2 -d -r1.45 -r1.46
*** rinterface.cpp	12 Apr 2006 13:12:48 -0000	1.45
--- rinterface.cpp	16 Apr 2006 23:01:22 -0000	1.46
***************
*** 46,49 ****
--- 46,50 ----
  #include <qdir.h>
  #include <qtimer.h>
+ #include <qvalidator.h>
  
  // update output (for immediate output commands) at least this often (msecs):
***************
*** 325,330 ****
  	RK_TRACE (RBACKEND);
  
! 	// first, copy out the type while mutex is locked. Allows for easier typing below
! 	MUTEX_LOCK;
  	RCallbackArgs::RCallbackType type = args->type;
  
--- 326,330 ----
  	RK_TRACE (RBACKEND);
  
! 	// first, copy out the type. Allows for easier typing below
  	RCallbackArgs::RCallbackType type = args->type;
  
***************
*** 332,338 ****
  		KMessageBox::information (0, QString (*(args->chars_a)), i18n ("Message from the R backend"));
  	} else if (type == RCallbackArgs::RReadConsole) {
! 		QString res = KInputDialog::getText (i18n ("R backend requests information"), QString (*(args->chars_a)));
  		res = res.left (args->int_a - 2) + "\n";
  		qstrcpy (*(args->chars_b), res.latin1 ());
  	} else if ((type == RCallbackArgs::RShowFiles) || (type == RCallbackArgs::REditFiles)) {
  		if ((type == RCallbackArgs::RShowFiles) && (QString (*(args->chars_d)) == "rkwardhtml")) {
--- 332,343 ----
  		KMessageBox::information (0, QString (*(args->chars_a)), i18n ("Message from the R backend"));
  	} else if (type == RCallbackArgs::RReadConsole) {
! 		bool ok;
! 		QRegExpValidator *dummy = new QRegExpValidator (QRegExp (".*"), 0);		// needed to allow empty strings in KInputDialog::getText
! 		QString res = KInputDialog::getText (i18n ("R backend requests information"), QString (*(args->chars_a)), QString::null, &ok, 0, 0, dummy);
! 		delete dummy;
  		res = res.left (args->int_a - 2) + "\n";
  		qstrcpy (*(args->chars_b), res.latin1 ());
+ 
+ 		if (!ok) cancelCommand (runningCommand ());
  	} else if ((type == RCallbackArgs::RShowFiles) || (type == RCallbackArgs::REditFiles)) {
  		if ((type == RCallbackArgs::RShowFiles) && (QString (*(args->chars_d)) == "rkwardhtml")) {
***************
*** 344,348 ****
  		} else {
  			ShowEditTextFileAgent::showEditFiles (args);
- 			MUTEX_UNLOCK;
  			return;
  		}
--- 349,352 ----
***************
*** 369,372 ****
--- 373,377 ----
  	}
  
+ 	MUTEX_LOCK;
  	args->done = true;
  	MUTEX_UNLOCK;

Index: rthread.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rbackend/rthread.cpp,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -d -r1.34 -r1.35
*** rthread.cpp	12 Apr 2006 13:12:48 -0000	1.34
--- rthread.cpp	16 Apr 2006 23:01:22 -0000	1.35
***************
*** 169,172 ****
--- 169,174 ----
  				command->status |= RCommand::ErrorSyntax;
  				RK_DO (qDebug ("Command failed (syntax)"), RBACKEND, DL_WARNING);
+ 			} else if (command->status & RCommand::Canceled) {
+ 				RK_DO (qDebug ("Command failed (interrupted)"), RBACKEND, DL_WARNING);
  			} else {
  				command->status |= RCommand::ErrorOther;





More information about the rkward-tracker mailing list