]>
cloud.milkyroute.net Git - dolphin.git/blob - src/tagcloud/newtagdialog.cpp
2 Copyright (C) 2008 by Sebastian Trueg <trueg at kde.org>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 #include "newtagdialog.h"
21 #include <nepomuk/tag.h>
25 #include <KTitleWidget>
28 NewTagDialog::NewTagDialog( QWidget
* parent
)
31 setCaption( i18nc( "@title:window", "Create new Tag" ) );
32 setButtons( Ok
|Cancel
);
33 enableButtonOk( false );
35 setupUi( mainWidget() );
37 connect( m_editTagLabel
, SIGNAL( textChanged(const QString
&) ),
38 this, SLOT( slotLabelChanged(const QString
&) ) );
42 NewTagDialog::~NewTagDialog()
47 void NewTagDialog::slotLabelChanged( const QString
& text
)
49 enableButtonOk( !text
.isEmpty() );
53 Nepomuk::Tag
NewTagDialog::createTag( QWidget
* parent
)
55 NewTagDialog
dlg( parent
);
56 dlg
.m_labelTitle
->setText( i18nc( "@title:window", "Create New Tag" ) );
57 dlg
.m_labelTitle
->setComment( i18nc( "@title:window subtitle to previous message", "with optional icon and description" ) );
58 dlg
.m_labelTitle
->setPixmap( KIcon( "nepomuk" ).pixmap( 32, 32 ) );
60 dlg
.m_editTagLabel
->setFocus();
63 QString name
= dlg
.m_editTagLabel
->text();
64 QString comment
= dlg
.m_editTagComment
->text();
65 QString icon
= dlg
.m_buttonTagIcon
->icon();
67 Nepomuk::Tag
newTag( name
);
68 newTag
.setLabel( name
);
69 newTag
.addIdentifier( name
);
70 if ( !comment
.isEmpty() ) {
71 newTag
.setDescription( comment
);
73 if ( !icon
.isEmpty() ) {
74 newTag
.addSymbol( icon
);
79 return Nepomuk::Tag();
83 #include "newtagdialog.moc"