2 avatardialog.cpp - Dialog to manage and select user avatar
4 Copyright (c) 2007 by Gustavo Pichorim Boiko <gustavo.boiko@kdemail.net>
5 Copyright (c) 2007 by Michaƫl Larouche <larouche@kde.org>
7 Kopete (c) 2002-2007 by the Kopete developers <kopete-devel@kde.org>
9 *************************************************************************
11 * This library is free software; you can redistribute it and/or *
12 * modify it under the terms of the GNU Lesser General Public *
13 * License as published by the Free Software Foundation; either *
14 * version 2 of the License, or (at your option) any later version. *
16 *************************************************************************
18 #include "avatardialog.h"
25 #include "avatarselectorwidget.h"
26 #include "kopeteavatarmanager.h"
34 class AvatarDialog::Private
41 AvatarSelectorWidget
*mainWidget
;
46 AvatarDialog::AvatarDialog(QWidget
*parent
)
47 : KDialog(parent
), d(new Private
)
49 showButtonSeparator(true);
50 setCaption( i18n("Select an avatar") );
51 setButtons( KDialog::Ok
| KDialog::Cancel
);
53 d
->mainWidget
= new Kopete::UI::AvatarSelectorWidget(this);
54 setMainWidget(d
->mainWidget
);
57 AvatarDialog::~AvatarDialog()
62 QString
AvatarDialog::selectedAvatarPath() const
64 return d
->selectedPath
;
67 QString
AvatarDialog::getAvatar(QWidget
*parent
, const QString
¤tAvatar
, bool * ok
)
69 AvatarDialog
dialog(parent
);
70 dialog
.d
->mainWidget
->setCurrentAvatar(currentAvatar
);
71 dialog
.d
->currentPath
= currentAvatar
;
72 if ( dialog
.exec() == QDialog::Accepted
)
84 return dialog
.selectedAvatarPath();
87 void AvatarDialog::slotButtonClicked(int button
)
89 if (button
== KDialog::Ok
)
91 Kopete::AvatarManager::AvatarEntry selectedEntry
= d
->mainWidget
->selectedEntry();
93 d
->selectedPath
= selectedEntry
.path
;
97 KDialog::slotButtonClicked(button
);
102 } // namespace Kopete
103 #include "avatardialog.moc"