From f404d942426f583c55c5c39996ed89a73fa8788f Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Mon, 3 Oct 2011 09:48:15 +0200 Subject: [PATCH] fixed issue http://188.165.53.52/jira/browse/SANKORE-287 --- src/gui/UBLibraryWidget.cpp | 29 +++++++++++++++++++++++++---- src/gui/UBLibraryWidget.h | 2 ++ 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/src/gui/UBLibraryWidget.cpp b/src/gui/UBLibraryWidget.cpp index 950c88ec..d8f035d2 100644 --- a/src/gui/UBLibraryWidget.cpp +++ b/src/gui/UBLibraryWidget.cpp @@ -513,6 +513,8 @@ UBNewFolderDlg::UBNewFolderDlg(QWidget *parent, const char *name):QDialog(parent , mpLabel(NULL) , mpLineEdit(NULL) , mpButtons(NULL) + , mpAddButton(NULL) + , mpCancelButton(NULL) , mpLayout(NULL) , mpHLayout(NULL) { @@ -521,18 +523,26 @@ UBNewFolderDlg::UBNewFolderDlg(QWidget *parent, const char *name):QDialog(parent mpLabel = new QLabel(tr("New Folder name:"),this); mpLineEdit = new QLineEdit(this); - mpButtons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this); + mpAddButton = new QPushButton(tr("Add")); + mpAddButton->setDefault(true); + + mpCancelButton = new QPushButton(tr("Cancel")); + mpCancelButton->setAutoDefault(false); + + mpButtons = new QDialogButtonBox(Qt::Horizontal, this); mpLayout = new QVBoxLayout(this); mpHLayout = new QHBoxLayout(this); - setLayout(mpLayout); mpLayout->addLayout(mpHLayout, 0); mpHLayout->addWidget(mpLabel, 0); mpHLayout->addWidget(mpLineEdit, 1); + + mpButtons->addButton(mpAddButton,QDialogButtonBox::ActionRole); + mpButtons->addButton(mpCancelButton,QDialogButtonBox::ActionRole); mpLayout->addWidget(mpButtons); - connect(mpButtons->button(QDialogButtonBox::Ok), SIGNAL(clicked()), this, SLOT(accept())); - connect(mpButtons->button(QDialogButtonBox::Cancel), SIGNAL(clicked()), this, SLOT(reject())); + connect(mpAddButton, SIGNAL(clicked()), this, SLOT(accept())); + connect(mpCancelButton, SIGNAL(clicked()), this, SLOT(reject())); connect(mpLineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(text_Changed(const QString &))); connect(mpLineEdit, SIGNAL(textEdited(const QString &)), this, SLOT(text_Edited(const QString &))); @@ -545,6 +555,17 @@ UBNewFolderDlg::UBNewFolderDlg(QWidget *parent, const char *name):QDialog(parent */ UBNewFolderDlg::~UBNewFolderDlg() { + if(NULL != mpAddButton) + { + delete mpAddButton; + mpAddButton = NULL; + } + + if(NULL != mpCancelButton) + { + delete mpCancelButton; + mpCancelButton = NULL; + } if(NULL != mpButtons) { delete mpButtons; diff --git a/src/gui/UBLibraryWidget.h b/src/gui/UBLibraryWidget.h index 3f05a008..5aed86b7 100644 --- a/src/gui/UBLibraryWidget.h +++ b/src/gui/UBLibraryWidget.h @@ -107,6 +107,8 @@ private: QLabel* mpLabel; QLineEdit* mpLineEdit; QDialogButtonBox* mpButtons; + QPushButton* mpAddButton; + QPushButton* mpCancelButton; QVBoxLayout* mpLayout; QHBoxLayout* mpHLayout; };