[rkward-cvs] rkward/rkward/windows rcontrolwindow.cpp,1.3,1.4 rcontrolwindow.h,1.2,1.3

Thomas Friedrichsmeier tfry at users.sourceforge.net
Sun Oct 16 14:06:52 UTC 2005


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

Modified Files:
	rcontrolwindow.cpp rcontrolwindow.h 
Log Message:
RControlWindow not pretty but working. Modify rkward.desktop to always start in a konsole

Index: rcontrolwindow.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/windows/rcontrolwindow.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** rcontrolwindow.cpp	14 Oct 2005 16:26:05 -0000	1.3
--- rcontrolwindow.cpp	16 Oct 2005 14:06:50 -0000	1.4
***************
*** 23,26 ****
--- 23,27 ----
  
  #include <klocale.h>
+ #include <kmessagebox.h>
  
  #include "../settings/rksettings.h"
***************
*** 58,61 ****
--- 59,64 ----
  	commands_view->addColumn (i18n ("Description"));
  	commands_view->setSorting (0);		// actually, we ignore the column, and do our own sorting
+ 	commands_view->setSelectionMode (QListView::Extended);
+ 	connect (commands_view, SIGNAL (selectionChanged ()), this, SLOT (commandSelectionChanged ()));
  	main_vbox->addWidget (commands_view);
  
***************
*** 99,103 ****
  	RK_TRACE (APP);
  
! 	chain_map[chain]->update (chain);
  }
  
--- 102,108 ----
  	RK_TRACE (APP);
  
! 	RControlWindowListViewItem *chainitem = chain_map[chain];
! 	chainitem->update (chain);
! 	checkCleanChain (chainitem);
  }
  
***************
*** 119,123 ****
  	command_map.remove (command);
  
! /* close parent chain(s) if applicable. This basically mimics the behavior in RCommandStack::pop () */
  	while (chain && chain->chain_closed && chain->parent () && (!chain->firstChild ())) {
  		RControlWindowListViewItem *del = chain;
--- 124,134 ----
  	command_map.remove (command);
  
! 	checkCleanChain (chain);
! }
! 
! void RControlWindow::checkCleanChain (RControlWindowListViewItem *chain) {
! 	if (!isShown ()) return;	// do expensive GUI stuff only when visible
! 	RK_TRACE (APP);
! 
  	while (chain && chain->chain_closed && chain->parent () && (!chain->firstChild ())) {
  		RControlWindowListViewItem *del = chain;
***************
*** 161,164 ****
--- 172,177 ----
  	}
  	if (running) setCommandRunning (running);
+ 
+ 	cancel_button->setEnabled (false);
  }
  
***************
*** 199,206 ****
--- 212,255 ----
  void RControlWindow::commandSelectionChanged () {
  	RK_TRACE (APP);
+ 
+ 	// we will make some modifications to the selection in here, so disconnect the SIGNAL first.
+ 	disconnect (commands_view, SIGNAL (selectionChanged ()), this, SLOT (commandSelectionChanged ()));
+ 
+ 	bool have_selection = false;
+ 	// if a chain is selected, select all of its child items
+ 	QListViewItemIterator itemit (commands_view, QListViewItemIterator::Selected);
+ 	while (itemit.current ()) {
+ 		QListViewItem *item = itemit.current ()->firstChild ();
+ 		while (item) {
+ 			item->setSelected (true);
+ 			item = item->nextSibling ();
+ 		}
+ 		have_selection = true;
+ 		++itemit;
+ 	}
+ 
+ 	cancel_button->setEnabled (have_selection);
+ 
+ 	connect (commands_view, SIGNAL (selectionChanged ()), this, SLOT (commandSelectionChanged ()));
  }
  
  void RControlWindow::cancelButtonClicked () {
  	RK_TRACE (APP);
+ 
+ 	bool some_not_cancelable = false;
+ 	// find out all the RCommands selected (not the chains)
+ 	for (QMap <RCommand *, RControlWindowListViewItem *>::const_iterator it = command_map.begin (); it != command_map.end (); ++it) {
+ 		if (it.data ()->isSelected ()) {
+ 			if (!(it.key ()->type () & RCommand::Sync)) {
+ 				RKGlobals::rInterface ()->cancelCommand (it.key ());
+ 			} else {
+ 				some_not_cancelable = true;
+ 			}
+ 		}
+ 	}
+ 
+ 	if (some_not_cancelable) {
+ 		KMessageBox::information (this, i18n ("Some of the commands you were trying to cancel are marked as \"sync\" (letter 'S' in the type column). Cancelling such commands could lead to loss of data. These commands have _not_ been cancelled."), i18n ("Some commands not cancelled"), "cancel_sync");
+ 	}
  }
  
***************
*** 300,304 ****
  	setText (1, dummy);
  
! 	if (command->type () & RCommand::Canceled) setText (2, i18n ("Cancelled"));
  
  	setText (3, command->rkEquivalent ());
--- 349,353 ----
  	setText (1, dummy);
  
! 	if (command->getStatus () & RCommand::Canceled) setText (2, i18n ("Cancelled"));
  
  	setText (3, command->rkEquivalent ());

Index: rcontrolwindow.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/windows/rcontrolwindow.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** rcontrolwindow.h	14 Oct 2005 15:57:43 -0000	1.2
--- rcontrolwindow.h	16 Oct 2005 14:06:50 -0000	1.3
***************
*** 75,78 ****
--- 75,80 ----
  	void addCommands (RChainOrCommand *coc, RControlWindowListViewItem *parent);
  	void addCommand (RCommand *command, RControlWindowListViewItem *parent);
+ /** delete chain(s) if applicable. This basically mimics the behavior in RCommandStack::pop () */
+ 	void checkCleanChain (RControlWindowListViewItem *chain);
  
  /** causes the RControlWindow (if shown) to refresh it's entire list of commands. Warning! Does not lock the mutex. Lock the mutex before calling this! */





More information about the rkward-tracker mailing list