• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdenetwork
  • Sitemap
  • Contact Us
 

kopete/libkopete

avatardialog.cpp

Go to the documentation of this file.
00001 /*
00002     avatardialog.cpp - Dialog to manage and select user avatar
00003 
00004     Copyright (c) 2007      by Gustavo Pichorim Boiko <gustavo.boiko@kdemail.net>
00005     Copyright (c) 2007      by Michaƫl Larouche       <larouche@kde.org>
00006 
00007     Kopete    (c) 2002-2007 by the Kopete developers  <kopete-devel@kde.org>
00008 
00009     *************************************************************************
00010     *                                                                       *
00011     * This library is free software; you can redistribute it and/or         *
00012     * modify it under the terms of the GNU Lesser General Public            *
00013     * License as published by the Free Software Foundation; either          *
00014     * version 2 of the License, or (at your option) any later version.      *
00015     *                                                                       *
00016     *************************************************************************
00017 */
00018 #include "avatardialog.h"
00019 
00020 // KDE includes
00021 #include <kdebug.h>
00022 #include <klocale.h>
00023 
00024 // Kopete includes
00025 #include "avatarselectorwidget.h"
00026 #include "kopeteavatarmanager.h"
00027 
00028 namespace Kopete
00029 {
00030 
00031 namespace UI
00032 {
00033 
00034 class AvatarDialog::Private
00035 {
00036 public:
00037     Private()
00038      : mainWidget(0)
00039     {}
00040 
00041     AvatarSelectorWidget *mainWidget;
00042     QString selectedPath;
00043     QString currentPath;
00044 };
00045 
00046 AvatarDialog::AvatarDialog(QWidget *parent)
00047  : KDialog(parent), d(new Private)
00048 {
00049     showButtonSeparator(true);
00050     setCaption( i18n("Select an avatar") );
00051     setButtons( KDialog::Ok | KDialog::Cancel );
00052 
00053     d->mainWidget = new Kopete::UI::AvatarSelectorWidget(this);
00054     setMainWidget(d->mainWidget);
00055 }
00056 
00057 AvatarDialog::~AvatarDialog()
00058 {
00059     delete d;
00060 }
00061 
00062 QString AvatarDialog::selectedAvatarPath() const
00063 {
00064     return d->selectedPath;
00065 }
00066 
00067 QString AvatarDialog::getAvatar(QWidget *parent, const QString &currentAvatar, bool * ok )
00068 {
00069     AvatarDialog dialog(parent);
00070     dialog.d->mainWidget->setCurrentAvatar(currentAvatar);
00071     dialog.d->currentPath = currentAvatar;
00072     if ( dialog.exec() == QDialog::Accepted )
00073     {
00074         if ( ok ) {
00075             *ok = true;
00076         }
00077     }
00078     else
00079     {
00080         if ( ok ) {
00081             *ok = false;
00082         }
00083     }
00084     return dialog.selectedAvatarPath();
00085 }
00086 
00087 void AvatarDialog::slotButtonClicked(int button)
00088 {
00089     if (button == KDialog::Ok)
00090     {
00091         Kopete::AvatarManager::AvatarEntry selectedEntry = d->mainWidget->selectedEntry();
00092 
00093         d->selectedPath = selectedEntry.path;
00094         emit result();
00095     }
00096 
00097     KDialog::slotButtonClicked(button);
00098 }
00099 
00100 } // namespace UI
00101 
00102 } // namespace Kopete
00103 #include "avatardialog.moc"

kopete/libkopete

Skip menu "kopete/libkopete"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdenetwork

Skip menu "kdenetwork"
  • kget
  • kopete
  •   kopete
  •   libkopete
  •       libpapillon
  • krfb
Generated for kdenetwork by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal