mirror of
https://invent.kde.org/system/dolphin
synced 2024-11-05 18:47:12 +00:00
Use the magic QFlags I love so much.
svn path=/trunk/KDE/kdebase/apps/; revision=1036578
This commit is contained in:
parent
59c430bb3f
commit
e1dde0669f
3 changed files with 15 additions and 12 deletions
|
@ -254,7 +254,7 @@ void MetaDataConfigurationDialog::slotButtonClicked(int button)
|
||||||
if (button == KDialog::Ok) {
|
if (button == KDialog::Ok) {
|
||||||
KConfig config("kmetainformationrc", KConfig::NoGlobals);
|
KConfig config("kmetainformationrc", KConfig::NoGlobals);
|
||||||
KConfigGroup showGroup = config.group("Show");
|
KConfigGroup showGroup = config.group("Show");
|
||||||
|
|
||||||
const int count = d->m_metaDataList->count();
|
const int count = d->m_metaDataList->count();
|
||||||
for (int i = 0; i < count; ++i) {
|
for (int i = 0; i < count; ++i) {
|
||||||
QListWidgetItem* item = d->m_metaDataList->item(i);
|
QListWidgetItem* item = d->m_metaDataList->item(i);
|
||||||
|
@ -262,13 +262,12 @@ void MetaDataConfigurationDialog::slotButtonClicked(int button)
|
||||||
const QString key = item->data(Qt::UserRole).toString();
|
const QString key = item->data(Qt::UserRole).toString();
|
||||||
showGroup.writeEntry(key, show);
|
showGroup.writeEntry(key, show);
|
||||||
}
|
}
|
||||||
|
|
||||||
showGroup.sync();
|
showGroup.sync();
|
||||||
|
|
||||||
if (d->m_metaDataWidget != 0) {
|
if (d->m_metaDataWidget != 0) {
|
||||||
// trigger an update
|
// trigger an update
|
||||||
const int data = d->m_metaDataWidget->hiddenData();
|
d->m_metaDataWidget->setHiddenData(d->m_metaDataWidget->hiddenData());
|
||||||
d->m_metaDataWidget->setHiddenData(data);
|
|
||||||
}
|
}
|
||||||
accept();
|
accept();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -96,7 +96,7 @@ public:
|
||||||
*/
|
*/
|
||||||
void startChangeDataJob(KJob* job);
|
void startChangeDataJob(KJob* job);
|
||||||
|
|
||||||
int m_hiddenData;
|
MetaDataTypes m_hiddenData;
|
||||||
QList<KFileItem> m_fileItems;
|
QList<KFileItem> m_fileItems;
|
||||||
QList<Row> m_rows;
|
QList<Row> m_rows;
|
||||||
|
|
||||||
|
@ -169,7 +169,7 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
MetaDataWidget::Private::Private(MetaDataWidget* parent) :
|
MetaDataWidget::Private::Private(MetaDataWidget* parent) :
|
||||||
m_hiddenData(0),
|
m_hiddenData(None),
|
||||||
m_fileItems(),
|
m_fileItems(),
|
||||||
m_rows(),
|
m_rows(),
|
||||||
m_gridLayout(0),
|
m_gridLayout(0),
|
||||||
|
@ -314,7 +314,7 @@ void MetaDataWidget::Private::initMetaInfoSettings()
|
||||||
}
|
}
|
||||||
|
|
||||||
void MetaDataWidget::Private::updateRowsVisibility()
|
void MetaDataWidget::Private::updateRowsVisibility()
|
||||||
{
|
{
|
||||||
KConfig config("kmetainformationrc", KConfig::NoGlobals);
|
KConfig config("kmetainformationrc", KConfig::NoGlobals);
|
||||||
KConfigGroup settings = config.group("Show");
|
KConfigGroup settings = config.group("Show");
|
||||||
setRowVisible(m_typeInfo,
|
setRowVisible(m_typeInfo,
|
||||||
|
@ -653,13 +653,13 @@ KFileItemList MetaDataWidget::items() const
|
||||||
return d->m_fileItems;
|
return d->m_fileItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MetaDataWidget::setHiddenData(int data)
|
void MetaDataWidget::setHiddenData(MetaDataTypes data)
|
||||||
{
|
{
|
||||||
d->m_hiddenData = data;
|
d->m_hiddenData = data;
|
||||||
d->updateRowsVisibility();
|
d->updateRowsVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
int MetaDataWidget::hiddenData() const
|
MetaDataWidget::MetaDataTypes MetaDataWidget::hiddenData() const
|
||||||
{
|
{
|
||||||
return d->m_hiddenData;
|
return d->m_hiddenData;
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,8 +61,9 @@ public:
|
||||||
* @see MetaDataWidget::setHiddenData()
|
* @see MetaDataWidget::setHiddenData()
|
||||||
* @see MetaDataWidget::hiddenData()
|
* @see MetaDataWidget::hiddenData()
|
||||||
*/
|
*/
|
||||||
enum Data
|
enum MetaDataType
|
||||||
{
|
{
|
||||||
|
None = 0,
|
||||||
TypeData = 1,
|
TypeData = 1,
|
||||||
SizeData= 2,
|
SizeData= 2,
|
||||||
ModifiedData = 4,
|
ModifiedData = 4,
|
||||||
|
@ -72,6 +73,7 @@ public:
|
||||||
TagsData = 64,
|
TagsData = 64,
|
||||||
CommentData = 128
|
CommentData = 128
|
||||||
};
|
};
|
||||||
|
Q_DECLARE_FLAGS( MetaDataTypes, MetaDataType )
|
||||||
|
|
||||||
explicit MetaDataWidget(QWidget* parent = 0);
|
explicit MetaDataWidget(QWidget* parent = 0);
|
||||||
virtual ~MetaDataWidget();
|
virtual ~MetaDataWidget();
|
||||||
|
@ -115,13 +117,13 @@ public:
|
||||||
* Example: metaDataWidget->setHiddenData(MetaDataWidget::TypeData | ModifiedData);
|
* Example: metaDataWidget->setHiddenData(MetaDataWidget::TypeData | ModifiedData);
|
||||||
* Per default no data is hidden.
|
* Per default no data is hidden.
|
||||||
*/
|
*/
|
||||||
void setHiddenData(int data);
|
void setHiddenData(MetaDataTypes data);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns which kind of data is hidden (@see MetaDataWidget::Data).
|
* Returns which kind of data is hidden (@see MetaDataWidget::Data).
|
||||||
* Example: if (metaDataWidget->hiddenData() & MetaDataWidget::TypeData) ...
|
* Example: if (metaDataWidget->hiddenData() & MetaDataWidget::TypeData) ...
|
||||||
*/
|
*/
|
||||||
int hiddenData() const;
|
MetaDataTypes hiddenData() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the rating for the currently set item(s). It is required
|
* Returns the rating for the currently set item(s). It is required
|
||||||
|
@ -195,4 +197,6 @@ private:
|
||||||
Q_PRIVATE_SLOT(d, void slotMetaDataUpdateDone())
|
Q_PRIVATE_SLOT(d, void slotMetaDataUpdateDone())
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Q_DECLARE_OPERATORS_FOR_FLAGS(MetaDataWidget::MetaDataTypes)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue