akregator/src
tagpropertiesdialog.cpp00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include <kicondialog.h>
00026 #include <klocale.h>
00027
00028 #include <qlineedit.h>
00029
00030 #include "tag.h"
00031 #include "tagpropertiesdialog.h"
00032 #include "tagpropertieswidgetbase.h"
00033
00034 namespace Akregator {
00035
00036 class TagPropertiesDialog::TagPropertiesDialogPrivate
00037 {
00038 public:
00039 Tag tag;
00040 TagPropertiesWidgetBase* widget;
00041 };
00042
00043 TagPropertiesDialog::TagPropertiesDialog(QWidget *parent, const char *name) : KDialogBase(KDialogBase::Swallow, Qt::WStyle_DialogBorder, parent, name, true, i18n("Tag Properties"), KDialogBase::Ok|KDialogBase::Cancel|KDialogBase::Apply), d(new TagPropertiesDialogPrivate)
00044 {
00045 d->widget = new TagPropertiesWidgetBase(this);
00046 setMainWidget(d->widget);
00047 d->widget->le_title->setFocus();
00048 enableButtonOK(false);
00049 enableButtonApply(false);
00050 connect(d->widget->le_title, SIGNAL(textChanged(const QString&)), this, SLOT(slotTextChanged(const QString& )));
00051 }
00052
00053 TagPropertiesDialog::~TagPropertiesDialog()
00054 {
00055 delete d;
00056 d = 0;
00057 }
00058
00059 void TagPropertiesDialog::setTag(const Tag& tag)
00060 {
00061 d->tag = tag;
00062 d->widget->le_title->setText(tag.name());
00063 d->widget->iconButton->setIcon(tag.icon());
00064 enableButtonOK(!tag.name().isEmpty());
00065 enableButtonApply(!tag.name().isEmpty());
00066 }
00067
00068 void TagPropertiesDialog::slotOk()
00069 {
00070 d->tag.setName(d->widget->le_title->text());
00071 d->tag.setIcon(d->widget->iconButton->icon());
00072 KDialogBase::slotOk();
00073 }
00074
00075 void TagPropertiesDialog::slotTextChanged(const QString& text)
00076 {
00077 enableButtonOK(!text.isEmpty());
00078 enableButtonApply(!text.isEmpty());
00079 }
00080
00081 void TagPropertiesDialog::slotApply()
00082 {
00083 d->tag.setName(d->widget->le_title->text());
00084 d->tag.setIcon(d->widget->iconButton->icon());
00085 KDialogBase::slotApply();
00086 }
00087
00088 }
00089
00090 #include "tagpropertiesdialog.moc"
|