# HG changeset patch
# User insilmaril
# Date 1157457234 0
# Node ID 97f5d07bf47d6e661b4f181637e0d33ea0f54c72
# Parent  1f6263d403a0bdc2d6db0ffd05b76ffee4cdebb9
fixed default shortcut in findwindow

diff -r 1f6263d403a0 -r 97f5d07bf47d findwindow.cpp
--- a/findwindow.cpp	Tue Sep 05 10:03:29 2006 +0000
+++ b/findwindow.cpp	Tue Sep 05 11:53:54 2006 +0000
@@ -1,77 +1,83 @@
-#include <qlineedit.h>
-//Added by qt3to4:
-#include <Q3HBoxLayout>
-#include <Q3VBoxLayout>
+#include <QLineEdit>
+#include <QVBoxLayout>
 #include <QLabel>
 
 #include "findwindow.h"
 #include "version.h"
 
 
-FindWindow::FindWindow(QWidget* parent, const char* name) 
-	: Q3GroupBox( 0, Qt::Horizontal, "Find", parent, name )
+FindWindow::FindWindow(QWidget* parent)
+	: QGroupBox( tr("Find"), parent )
 
 {
-	setCaption (__VYM " - " +tr("Find Text"));
+	setWindowTitle(__VYM " - " +tr("Find Text"));
 	//resize (180,130);
-	move (130,130);
+	//move (130,130);
 
-	//FIXME not avail in QT4 setMargin( 100 );
+    QVBoxLayout* mainLayout = new QVBoxLayout;
+    
+    QHBoxLayout *row1Layout = new QHBoxLayout;
+    // Create a Label
+    QLabel* label = new QLabel;
+    label->setText( tr("Text to find:"));
+    row1Layout->addWidget( label );
 
-    Q3VBoxLayout* box = new Q3VBoxLayout( layout() );
-    
-    Q3HBoxLayout *row1 = new Q3HBoxLayout( box );
-    row1->setMargin( 10 );
-
-    // Create a Label
-    QLabel* label = new QLabel( "Text to find: ", this);
-    row1->addWidget( label );
 
 	// Create LineEdit (here QComboBox)
-    Q3HBoxLayout *row2 = new Q3HBoxLayout( box );
-    row2->setMargin( 10 );
-    findcombo = new QComboBox( true, this );
+    QHBoxLayout *row2Layout = new QHBoxLayout;
+    findcombo = new QComboBox;
 	findcombo->setMinimumWidth(150);
-    row2->addWidget( findcombo );
+	findcombo->setEditable(true);
 	connect ( findcombo, SIGNAL( highlighted(int) ), 
 		this, SLOT( findPressed() ) );
 	connect ( findcombo, SIGNAL( textChanged(const QString &) ), 
 		this, SLOT( findTextChanged(const QString&) ) );
     //findcombo->insertItem( "Normal", -1 );
 
+	row2Layout->addWidget(findcombo);
+
 	// Create Buttons
-    Q3HBoxLayout *row3 = new Q3HBoxLayout( box );
-    row3->setMargin( 10 );
-	clearbutton = new QPushButton (tr("Clear"),this);
-	connect ( clearbutton, SIGNAL( clicked() ), 
-		findcombo, SLOT( clearEdit() ) );
-	row3->addWidget (clearbutton);
+    QHBoxLayout *row3Layout = new QHBoxLayout;
+	clearbutton = new QPushButton;
+	clearbutton->setText(tr("Clear"));
+	connect ( clearbutton, SIGNAL( clicked() ), this, SLOT( clearLineEdit() ) );
+	row3Layout->addWidget (clearbutton);
 	
+	/*
 	QSpacerItem *si1= new QSpacerItem (10,0,QSizePolicy::Minimum, QSizePolicy::Expanding );
-	row3->addItem(si1);
+	row3Layout->addItem(si1);
+	*/
 	
-	cancelbutton = new QPushButton (tr("Cancel"),this);
-	cancelbutton->setAccel (Qt::Key_Escape);
-	connect ( cancelbutton, SIGNAL( clicked() ), 
-		this, SLOT( cancelPressed() ) );
-	row3->addWidget (cancelbutton);
+	cancelbutton = new QPushButton;
+	cancelbutton->setText(tr("Cancel"));
+	cancelbutton->setShortcut (Qt::Key_Escape);
+	connect ( cancelbutton, SIGNAL( clicked() ), this, SLOT( cancelPressed() ) );
+	row3Layout->addWidget (cancelbutton);
 
+/*
 	QSpacerItem *si2= new QSpacerItem (10,0,QSizePolicy::Fixed, QSizePolicy::Fixed);
-	row3->addItem(si2);
+	row3Layout->addItem(si2);
+	*/
 	
-	findbutton = new QPushButton (tr("Find"),this);
+	findbutton = new QPushButton;
+	findbutton->setText (tr("Find"));
 	findbutton->setDefault (true);
-	connect ( findbutton, SIGNAL( clicked() ), 
-		this, SLOT( findPressed() ) );
-	row3->add(findbutton);
-	
-	findcombo->setFocus();
+	findbutton->setShortcut (Qt::Key_Return);
+	connect ( findbutton, SIGNAL( clicked() ), this, SLOT( findPressed() ) );
+
+	row3Layout->addWidget(findbutton);
+
+	mainLayout->addLayout (row1Layout);
+	mainLayout->addLayout (row2Layout);
+	mainLayout->addLayout (row3Layout);
+	setLayout (mainLayout);
 }
 
 void FindWindow::popup()
 {
+	show();
 	findcombo->lineEdit()->selectAll();
-	show();
+	findcombo->setFocus();
 }
 
 void FindWindow::cancelPressed()
@@ -88,3 +94,8 @@
 {
 	emit (somethingChanged() );
 }
+
+void FindWindow::clearLineEdit()
+{
+	findcombo->lineEdit()->clear();
+}