mirror of
https://invent.kde.org/system/dolphin
synced 2024-09-17 15:31:20 +00:00
Fixed some minor coding guidelines issues (getFoo() -> foo(), ...) to be aligned with the kdelibs coding style (http://techbase.kde.org/Policies/Kdelibs_Coding_Style). The infosidebar code will be rewritten anyway, but copy/paste often is faster than light ;-)
svn path=/trunk/KDE/kdebase/apps/; revision=642613
This commit is contained in:
parent
4dcb9b7a48
commit
8a7f84326d
|
@ -519,7 +519,7 @@ void InfoSidebarPage::insertActions()
|
||||||
void InfoSidebarPage::showAnnotation(const KUrl& file)
|
void InfoSidebarPage::showAnnotation(const KUrl& file)
|
||||||
{
|
{
|
||||||
if(m_metadata->storageUp()) {
|
if(m_metadata->storageUp()) {
|
||||||
QString text = m_metadata->getAnnotation(file);
|
QString text = m_metadata->annotation(file);
|
||||||
if (!text.isEmpty()) {
|
if (!text.isEmpty()) {
|
||||||
m_annotationLabel->show();
|
m_annotationLabel->show();
|
||||||
m_annotationLabel->setText(QString("<b>%1</b> :<br/>%2").arg(i18n("Annotation")).arg(text));
|
m_annotationLabel->setText(QString("<b>%1</b> :<br/>%2").arg(i18n("Annotation")).arg(text));
|
||||||
|
@ -533,16 +533,16 @@ void InfoSidebarPage::showAnnotation(const KUrl& file)
|
||||||
|
|
||||||
void InfoSidebarPage::showAnnotations(const KUrl::List& files)
|
void InfoSidebarPage::showAnnotations(const KUrl::List& files)
|
||||||
{
|
{
|
||||||
static unsigned int maxShownAnnot = 3; //The maximum number of show annotations when selecting multiple files
|
|
||||||
if (m_metadata->storageUp()) {
|
if (m_metadata->storageUp()) {
|
||||||
bool hasAnnotation = false;
|
bool hasAnnotation = false;
|
||||||
unsigned int annotateNum = 0;
|
unsigned int annotateNum = 0;
|
||||||
QString firsts = QString("<b>%1 :</b><br/>").arg(i18n("Annotations"));
|
QString firsts = QString("<b>%1 :</b><br/>").arg(i18n("Annotations"));
|
||||||
foreach (KUrl file, files) {
|
foreach (KUrl file, files) {
|
||||||
QString annotation = m_metadata->getAnnotation(file);
|
QString annotation = m_metadata->annotation(file);
|
||||||
if (!annotation.isEmpty()) {
|
if (!annotation.isEmpty()) {
|
||||||
hasAnnotation = true;
|
hasAnnotation = true;
|
||||||
if(annotateNum < maxShownAnnot) {
|
if (annotateNum < 3) {
|
||||||
|
// don't show more than 3 annotations
|
||||||
firsts += m_annotationLabel->fontMetrics().elidedText(QString("<b>%1</b> : %2<br/>").arg(file.fileName()).arg(annotation), Qt::ElideRight, width());//FIXME not really the good method, does not handle resizing ...
|
firsts += m_annotationLabel->fontMetrics().elidedText(QString("<b>%1</b> : %2<br/>").arg(file.fileName()).arg(annotation), Qt::ElideRight, width());//FIXME not really the good method, does not handle resizing ...
|
||||||
annotateNum++;
|
annotateNum++;
|
||||||
}
|
}
|
||||||
|
@ -551,7 +551,10 @@ void InfoSidebarPage::showAnnotations(const KUrl::List& files)
|
||||||
if (hasAnnotation) {
|
if (hasAnnotation) {
|
||||||
m_annotationLabel->show();
|
m_annotationLabel->show();
|
||||||
m_annotationLabel->setText(firsts);
|
m_annotationLabel->setText(firsts);
|
||||||
} else m_annotationLabel->hide();
|
}
|
||||||
|
else {
|
||||||
|
m_annotationLabel->hide();
|
||||||
|
}
|
||||||
m_annotationButton->setText(hasAnnotation ? i18n("Change annotations") : i18n("Annotate files"));
|
m_annotationButton->setText(hasAnnotation ? i18n("Change annotations") : i18n("Annotate files"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -566,7 +569,7 @@ void InfoSidebarPage::changeAnnotation()
|
||||||
}
|
}
|
||||||
else if (files.count() == 1) {
|
else if (files.count() == 1) {
|
||||||
name = files[0].url();
|
name = files[0].url();
|
||||||
old = m_metadata->getAnnotation(files[0]);
|
old = m_metadata->annotation(files[0]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
name = QString("%1 files").arg(files.count());
|
name = QString("%1 files").arg(files.count());
|
||||||
|
|
|
@ -35,7 +35,8 @@ MetadataLoader::MetadataLoader()
|
||||||
if (Nepomuk::KMetaData::ResourceManager::instance()->init()) {
|
if (Nepomuk::KMetaData::ResourceManager::instance()->init()) {
|
||||||
m_up = false;
|
m_up = false;
|
||||||
Nepomuk::KMetaData::ResourceManager::instance()->setAutoSync(false);
|
Nepomuk::KMetaData::ResourceManager::instance()->setAutoSync(false);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
m_up = true;
|
m_up = true;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -51,7 +52,7 @@ bool MetadataLoader::storageUp() {
|
||||||
return m_up;
|
return m_up;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString MetadataLoader::getAnnotation(const KUrl& file)
|
QString MetadataLoader::annotation(const KUrl& file)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_KMETADATA
|
#ifdef HAVE_KMETADATA
|
||||||
if(m_up)
|
if(m_up)
|
||||||
|
@ -64,8 +65,9 @@ QString MetadataLoader::getAnnotation(const KUrl& file)
|
||||||
void MetadataLoader::setAnnotation(const KUrl& file, const QString& annotation)
|
void MetadataLoader::setAnnotation(const KUrl& file, const QString& annotation)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_KMETADATA
|
#ifdef HAVE_KMETADATA
|
||||||
if(m_up)
|
if (m_up) {
|
||||||
Nepomuk::KMetaData::File(file.url()).setComment(annotation);
|
Nepomuk::KMetaData::File(file.url()).setComment(annotation);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,11 +21,6 @@
|
||||||
#ifndef METADATALOADER_H
|
#ifndef METADATALOADER_H
|
||||||
#define METADATALOADER_H
|
#define METADATALOADER_H
|
||||||
|
|
||||||
namespace Nempomuk {
|
|
||||||
namespace Backbone {
|
|
||||||
class Registry;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
class KUrl;
|
class KUrl;
|
||||||
class QString;
|
class QString;
|
||||||
|
|
||||||
|
@ -42,7 +37,7 @@ public:
|
||||||
~MetadataLoader();
|
~MetadataLoader();
|
||||||
bool storageUp();
|
bool storageUp();
|
||||||
|
|
||||||
QString getAnnotation(const KUrl& file);
|
QString annotation(const KUrl& file);
|
||||||
void setAnnotation(const KUrl& file, const QString& annotation);
|
void setAnnotation(const KUrl& file, const QString& annotation);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Reference in a new issue