[rkward-cvs] rkward/rkward/dialogs rkreadlinedialog.cpp,1.1,1.2

Thomas Friedrichsmeier tfry at users.sourceforge.net
Sun Sep 17 11:34:02 UTC 2006


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

Modified Files:
	rkreadlinedialog.cpp 
Log Message:
RKReadLineDialog: delete after use, use sensible default width, allow word breaks in prompt

Index: rkreadlinedialog.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/dialogs/rkreadlinedialog.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** rkreadlinedialog.cpp	15 Sep 2006 17:23:12 -0000	1.1
--- rkreadlinedialog.cpp	17 Sep 2006 11:34:00 -0000	1.2
***************
*** 22,25 ****
--- 22,27 ----
  #include <qlabel.h>
  #include <qvbox.h>
+ #include <qapplication.h>
+ #include <qdesktopwidget.h>
  
  #include <klocale.h>
***************
*** 31,38 ****
--- 33,43 ----
  RKReadLineDialog::RKReadLineDialog (QWidget *parent, const QString &caption, const QString &prompt, RCommand *command) : KDialogBase (parent, 0, true, caption, KDialogBase::Ok | KDialogBase::Cancel) {
  	RK_TRACE (DIALOGS);
+ 	RK_ASSERT (command);
  
  	QVBox *page = makeVBoxMainWidget ();
  	new QLabel (caption, page);
  
+ 	int screen_width = qApp->desktop ()->width () - 2*marginHint() - 2*spacingHint ();		// TODO is this correct on xinerama?
+ 
  	QString context = command->fullOutput ();
  	if (!context.isEmpty ()) {
***************
*** 46,54 ****
  		output->setText (context);
  		output->setReadOnly (true);
! 		setMinimumWidth (output->contentsWidth ());		// TODO: should never be wider than screen
  		output->scrollToBottom ();
  	}
  
! 	new QLabel (prompt, page);
  
  	input = new QLineEdit (QString (), page);
--- 51,61 ----
  		output->setText (context);
  		output->setReadOnly (true);
! 		int cwidth = output->contentsWidth ();
! 		output->setMinimumWidth (screen_width < cwidth ? screen_width : cwidth);
  		output->scrollToBottom ();
  	}
  
! 	QLabel *promptl = new QLabel (prompt, page);
! 	promptl->setAlignment (Qt::WordBreak | promptl->alignment ());
  
  	input = new QLineEdit (QString (), page);
***************
*** 68,73 ****
  	int res = dialog->exec ();
  	*result = dialog->input->text ();
  
! 	if (res == KDialogBase::Cancel) return false;
! 	return true;
  }
--- 75,80 ----
  	int res = dialog->exec ();
  	*result = dialog->input->text ();
+ 	delete dialog;
  
! 	return (res != KDialogBase::Cancel);
  }





More information about the rkward-tracker mailing list