]>
cloud.milkyroute.net Git - dolphin.git/blob - src/search/searchcriterionvalue.cpp
1 /***************************************************************************
2 * Copyright (C) 2009 by Adam Kidder <thekidder@gmail.com> *
3 * Copyright (C) 2009 by Peter Penz <peter.penz@gmx.at> *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
19 ***************************************************************************/
21 #include "searchcriterionvalue.h"
23 #include <klineedit.h>
26 #include <nepomuk/tag.h>
31 #include <QHBoxLayout>
34 SearchCriterionValue::SearchCriterionValue(QWidget
* parent
) :
39 SearchCriterionValue::~SearchCriterionValue()
43 // -------------------------------------------------------------------------
45 DateValue::DateValue(QWidget
* parent
) :
46 SearchCriterionValue(parent
),
49 m_dateEdit
= new QDateEdit(this);
51 QHBoxLayout
* layout
= new QHBoxLayout(this);
53 layout
->addWidget(m_dateEdit
);
56 DateValue::~DateValue()
60 QString
DateValue::value() const
65 // -------------------------------------------------------------------------
67 TagValue::TagValue(QWidget
* parent
) :
68 SearchCriterionValue(parent
),
71 m_tags
= new QComboBox(this);
72 m_tags
->setInsertPolicy(QComboBox::InsertAlphabetically
);
74 QHBoxLayout
* layout
= new QHBoxLayout(this);
76 layout
->addWidget(m_tags
);
83 QString
TagValue::value() const
88 void TagValue::showEvent(QShowEvent
* event
)
90 if (!event
->spontaneous() && (m_tags
->count() == 0)) {
91 const QList
<Nepomuk::Tag
> tags
= Nepomuk::Tag::allTags();
92 foreach (const Nepomuk::Tag
& tag
, tags
) {
93 m_tags
->addItem(tag
.label());
96 if (tags
.count() == 0) {
97 m_tags
->addItem(i18nc("@label", "No Tags Available"));
100 SearchCriterionValue::showEvent(event
);
103 // -------------------------------------------------------------------------
105 SizeValue::SizeValue(QWidget
* parent
) :
106 SearchCriterionValue(parent
),
110 m_lineEdit
= new KLineEdit(this);
111 m_lineEdit
->setClearButtonShown(true);
113 m_units
= new QComboBox(this);
114 // TODO: check the KByte vs. KiByte dilemma :-/
115 m_units
->addItem(i18nc("@label", "Byte"));
116 m_units
->addItem(i18nc("@label", "KByte"));
117 m_units
->addItem(i18nc("@label", "MByte"));
118 m_units
->addItem(i18nc("@label", "GByte"));
120 QHBoxLayout
* layout
= new QHBoxLayout(this);
121 layout
->setMargin(0);
122 layout
->addWidget(m_lineEdit
);
123 layout
->addWidget(m_units
);
126 SizeValue::~SizeValue()
130 QString
SizeValue::value() const
135 #include "searchcriterionvalue.moc"