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

akonadi

renamefavoritedialog.cpp
00001 /*
00002     Copyright (c) 2011 Laurent Montel <montel@kde.org>
00003 
00004     This library is free software; you can redistribute it and/or modify it
00005     under the terms of the GNU Library General Public License as published by
00006     the Free Software Foundation; either version 2 of the License, or (at your
00007     option) any later version.
00008 
00009     This library is distributed in the hope that it will be useful, but WITHOUT
00010     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00011     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00012     License for more details.
00013 
00014     You should have received a copy of the GNU Library General Public License
00015     along with this library; see the file COPYING.LIB.  If not, write to the
00016     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00017     02110-1301, USA.
00018 */
00019 
00020 
00021 #include "renamefavoritedialog.h"
00022 #include <QLabel>
00023 #include <KLineEdit>
00024 #include <KStandardGuiItem>
00025 #include <KLocale>
00026 #include <QVBoxLayout>
00027 
00028 RenameFavoriteDialog::RenameFavoriteDialog(const QString& caption, const QString& text, const QString& value, const QString& defaultName, QWidget *parent )
00029   :KDialog( parent ),
00030    m_defaultName( defaultName )
00031 {
00032   setCaption(caption);
00033   setButtons(Ok | Cancel | User1);
00034   setButtonGuiItem(User1, KGuiItem(i18n("Default Name")));
00035   setDefaultButton(Ok);
00036   setModal(true);
00037 
00038   QWidget *frame = new QWidget(this);
00039   QVBoxLayout *layout = new QVBoxLayout(frame);
00040   layout->setMargin(0);
00041 
00042   m_label = new QLabel(text, frame);
00043   m_label->setWordWrap(true);
00044   layout->addWidget(m_label);
00045 
00046   m_lineEdit = new KLineEdit(value, frame);
00047   m_lineEdit->setClearButtonShown(true);
00048   layout->addWidget(m_lineEdit);
00049 
00050   m_lineEdit->setFocus();
00051   m_label->setBuddy(m_lineEdit);
00052 
00053   layout->addStretch();
00054 
00055   connect(m_lineEdit, SIGNAL(textChanged(QString)),
00056           SLOT(slotEditTextChanged(QString)));
00057   connect(this, SIGNAL(user1Clicked()), this, SLOT(slotDefaultName()));
00058 
00059 
00060   setMainWidget(frame);
00061   slotEditTextChanged(value);
00062   setMinimumWidth(350);
00063 
00064 }
00065 
00066 RenameFavoriteDialog::~RenameFavoriteDialog()
00067 {
00068 }
00069 
00070 void RenameFavoriteDialog::slotDefaultName()
00071 {
00072   m_lineEdit->setText( m_defaultName );
00073 }
00074 
00075 void RenameFavoriteDialog::slotEditTextChanged(const QString& text)
00076 {
00077   enableButton( Ok, !text.trimmed().isEmpty() );
00078 }
00079 
00080 
00081 QString RenameFavoriteDialog::newName() const
00082 {
00083   return m_lineEdit->text();
00084 }
00085 
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Mon Aug 27 2012 22:09:23 by doxygen 1.7.5 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.8.5 API Reference

Skip menu "kdepimlibs-4.8.5 API Reference"
  • akonadi
  •   contact
  •   kmime
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  •   richtextbuilders
  • 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