[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdevelop/parts/doctreeview
From:       Laurent Montel <montel () kde ! org>
Date:       2003-11-09 18:37:35
[Download RAW message or body]

CVS commit by mlaurent: 

enable-disable ok button


  M +14 -6     adddocitemdlg.cpp   1.12
  M +3 -2      adddocitemdlg.h   1.5


--- kdevelop/parts/doctreeview/adddocitemdlg.cpp  #1.11:1.12
@@ -23,5 +23,6 @@
 #include <kfiledialog.h>
 #include <klocale.h>
-
+#include <kstdguiitem.h>
+#include <klineedit.h>
 
 AddDocItemDialog::AddDocItemDialog(KFile::Mode mode, QString filter, TitleType \
checkDocTitle, QString title, QString url, QWidget *parent, const char *name) @@ \
-83,8 +84,8 @@ AddDocItemDialog::AddDocItemDialog(KFile  KButtonBox *buttonbox = new \
KButtonBox(this);  buttonbox->addStretch();
-    QPushButton *ok = buttonbox->addButton(i18n("&OK"));
-    QPushButton *cancel = buttonbox->addButton(i18n("Cancel"));
-    ok->setDefault(true);
-    connect( ok, SIGNAL(clicked()), this, SLOT(accept()) );
+    m_pOk = buttonbox->addButton(KStdGuiItem::ok().text());
+    QPushButton *cancel = buttonbox->addButton(KStdGuiItem::cancel().text());
+    m_pOk->setDefault(true);
+    connect( m_pOk, SIGNAL(clicked()), this, SLOT(accept()) );
     connect( cancel, SIGNAL(clicked()), this, SLOT(reject()) );
     buttonbox->layout();
@@ -98,4 +99,6 @@ AddDocItemDialog::AddDocItemDialog(KFile
         connect(url_edit, SIGNAL(textChanged(const QString&)), this, \
SLOT(setTitle(const QString&)));  }
+    connect( url_edit, SIGNAL(textChanged(const QString&)), this, \
SLOT(setLocationChanged(const QString&))); +    \
setLocationChanged(url_edit->lineEdit()->text() );  }
 
@@ -103,4 +106,9 @@ AddDocItemDialog::AddDocItemDialog(KFile
 AddDocItemDialog::~AddDocItemDialog()
 {}
+
+void AddDocItemDialog::setLocationChanged(const QString & _text )
+{
+    m_pOk->setEnabled( !_text.isEmpty() );
+}
 
 void AddDocItemDialog::setTitle(const QString &str)

--- kdevelop/parts/doctreeview/adddocitemdlg.h  #1.4:1.5
@@ -20,5 +20,5 @@
 #include <kurlrequester.h>
 #include <kfile.h>
-
+class QPushButton;
 
 class AddDocItemDialog : public QDialog
@@ -40,5 +40,5 @@ public:
 private slots:
     void setTitle(const QString &str);
-
+    void setLocationChanged(const QString & _text );
 private:
     QLineEdit *title_edit;
@@ -48,4 +48,5 @@ private:
     QString m_filter;
     QCheckBox *title_check;
+    QPushButton *m_pOk;
 };
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic