X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/5252c12db4929886dbe502013e0a1fee6500f568..b5cc2a6924cfd8f59611d3cec2edbb00a08b4ff1:/src/renamedialog.cpp diff --git a/src/renamedialog.cpp b/src/renamedialog.cpp index 301c02713..8aabb2f83 100644 --- a/src/renamedialog.cpp +++ b/src/renamedialog.cpp @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * ***************************************************************************/ #include "renamedialog.h" @@ -29,29 +29,35 @@ #include RenameDialog::RenameDialog(const KUrl::List& items) : - KDialogBase(Plain, i18n("Rename Items"), - Ok|Cancel, Ok) + KDialog() { - setButtonOK(KGuiItem(i18n("Rename"), "apply")); + setCaption(i18n("Rename Items")); + setButtons(Ok|Cancel); + setDefaultButton(Ok); - Q3VBoxLayout* topLayout = new Q3VBoxLayout(plainPage(), 0, spacingHint()); + setButtonGuiItem(Ok, KGuiItem(i18n("Rename"), "dialog-apply")); + + QWidget *page = new QWidget(this); + setMainWidget(page); + + Q3VBoxLayout* topLayout = new Q3VBoxLayout(page, 0, spacingHint()); topLayout->setMargin(KDialog::marginHint()); const int itemCount = items.count(); - QLabel* editLabel = new QLabel(i18n("Rename the %1 selected items to:").arg(itemCount), - plainPage()); + QLabel* editLabel = new QLabel(i18n("Rename the %1 selected items to:",itemCount), + page); - m_lineEdit = new KLineEdit(plainPage()); + m_lineEdit = new KLineEdit(page); m_newName = i18n("New name #"); assert(itemCount > 1); - QString postfix(items[0].prettyURL().section('.',1)); + QString postfix(items[0].prettyUrl().section('.',1)); if (postfix.length() > 0) { // The first item seems to have a postfix (e. g. 'jpg' or 'txt'). Now // check whether all other items have the same postfix. If this is the // case, add this postfix to the name suggestion. postfix.insert(0, '.'); for (int i = 1; i < itemCount; ++i) { - if (!items[i].prettyURL().contains(postfix)) { + if (!items[i].prettyUrl().contains(postfix)) { // at least one item does not have the same postfix postfix.truncate(0); break; @@ -67,7 +73,7 @@ RenameDialog::RenameDialog(const KUrl::List& items) : m_lineEdit->setSelection(0, selectionLength - 1); m_lineEdit->setFocus(); - QLabel* infoLabel = new QLabel(i18n("(# will be replaced by ascending numbers)"), plainPage()); + QLabel* infoLabel = new QLabel(i18n("(# will be replaced by ascending numbers)"), page); topLayout->addWidget(editLabel); topLayout->addWidget(m_lineEdit); @@ -78,14 +84,16 @@ RenameDialog::~RenameDialog() { } -void RenameDialog::slotOk() +void RenameDialog::slotButtonClicked(int button) { - m_newName = m_lineEdit->text(); - if (m_newName.contains('#') != 1) { - m_newName.truncate(0); + if (button==Ok) { + m_newName = m_lineEdit->text(); + if (m_newName.contains('#') != 1) { + m_newName.truncate(0); + } } - KDialogBase::slotOk(); + KDialog::slotButtonClicked(button); } #include "renamedialog.moc"