• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.10.5 API Reference
  • KDE Home
  • Contact Us
 

akonadi

  • akonadi
renamefavoritedialog.cpp
1 /*
2  Copyright (c) 2011 Laurent Montel <montel@kde.org>
3 
4  This library is free software; you can redistribute it and/or modify it
5  under the terms of the GNU Library General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or (at your
7  option) any later version.
8 
9  This library is distributed in the hope that it will be useful, but WITHOUT
10  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12  License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to the
16  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17  02110-1301, USA.
18 */
19 
20 
21 #include "renamefavoritedialog.h"
22 #include <QLabel>
23 #include <KLineEdit>
24 #include <KStandardGuiItem>
25 #include <KLocale>
26 #include <QVBoxLayout>
27 
28 RenameFavoriteDialog::RenameFavoriteDialog(const QString& caption, const QString& text, const QString& value, const QString& defaultName, QWidget *parent )
29  :KDialog( parent ),
30  m_defaultName( defaultName )
31 {
32  setCaption(caption);
33  setButtons(Ok | Cancel | User1);
34  setButtonGuiItem(User1, KGuiItem(i18n("Default Name")));
35  setDefaultButton(Ok);
36  setModal(true);
37 
38  QWidget *frame = new QWidget(this);
39  QVBoxLayout *layout = new QVBoxLayout(frame);
40  layout->setMargin(0);
41 
42  m_label = new QLabel(text, frame);
43  m_label->setWordWrap(true);
44  layout->addWidget(m_label);
45 
46  m_lineEdit = new KLineEdit(value, frame);
47  m_lineEdit->setClearButtonShown(true);
48  layout->addWidget(m_lineEdit);
49 
50  m_lineEdit->setFocus();
51  m_label->setBuddy(m_lineEdit);
52 
53  layout->addStretch();
54 
55  connect(m_lineEdit, SIGNAL(textChanged(QString)),
56  SLOT(slotEditTextChanged(QString)));
57  connect(this, SIGNAL(user1Clicked()), this, SLOT(slotDefaultName()));
58 
59 
60  setMainWidget(frame);
61  slotEditTextChanged(value);
62  setMinimumWidth(350);
63 
64 }
65 
66 RenameFavoriteDialog::~RenameFavoriteDialog()
67 {
68 }
69 
70 void RenameFavoriteDialog::slotDefaultName()
71 {
72  m_lineEdit->setText( m_defaultName );
73 }
74 
75 void RenameFavoriteDialog::slotEditTextChanged(const QString& text)
76 {
77  enableButton( Ok, !text.trimmed().isEmpty() );
78 }
79 
80 
81 QString RenameFavoriteDialog::newName() const
82 {
83  return m_lineEdit->text();
84 }
85 
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Sat Jul 13 2013 01:27:40 by doxygen 1.8.3.1 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

akonadi

Skip menu "akonadi"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Modules
  • Related Pages

kdepimlibs-4.10.5 API Reference

Skip menu "kdepimlibs-4.10.5 API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal