X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/d84909dc36acbd91c37de76e793f81dca9b2ace9..d64bbc333c5014fad116efc98b77cf3268fc07e0:/src/dolphinmodel.cpp diff --git a/src/dolphinmodel.cpp b/src/dolphinmodel.cpp index 3b507a895..d81e0c38b 100644 --- a/src/dolphinmodel.cpp +++ b/src/dolphinmodel.cpp @@ -24,14 +24,6 @@ #include "kcategorizedview.h" -#include -#ifdef HAVE_NEPOMUK -#include -#include -#include -#include -#endif - #include #include #include @@ -49,13 +41,14 @@ #include #include -const char* DolphinModel::m_others = I18N_NOOP2("@title:group Name", "Others"); +const char* const DolphinModel::m_others = I18N_NOOP2("@title:group Name", "Others"); DolphinModel::DolphinModel(QObject* parent) : KDirModel(parent), m_hasVersionData(false), m_revisionHash() { + setJobTransfersVisible(true); } DolphinModel::~DolphinModel() @@ -120,6 +113,12 @@ QVariant DolphinModel::data(const QModelIndex& index, int role) const return i18nc("@item::intable", "Unversioned"); } } + else if (index.column() == DolphinModel::LinkDestination) { + const KDirModel *dirModel = qobject_cast(index.model()); + KFileItem item = dirModel->itemForIndex(index); + return item.linkDest(); + } + break; default: @@ -132,12 +131,14 @@ QVariant DolphinModel::data(const QModelIndex& index, int role) const QVariant DolphinModel::headerData(int section, Qt::Orientation orientation, int role) const { if ((orientation == Qt::Horizontal) && (role == Qt::DisplayRole)) { - if (section < KDirModel::ColumnCount) { + switch (section) { + case DolphinModel::Version: + return i18nc("@title::column", "Version"); + case DolphinModel::LinkDestination: + return i18nc("@title::column", "Link Destination"); + default: return KDirModel::headerData(section, orientation, role); } - - Q_ASSERT(section == DolphinModel::Version); - return i18nc("@title::column", "Version"); } return QVariant(); } @@ -217,11 +218,7 @@ QVariant DolphinModel::displayRoleData(const QModelIndex& index) const } } - if (!validCategory) { - retString = validCategory ? *currA : i18nc("@title:group Name", m_others); - } else { - retString = *currA; - } + retString = validCategory ? *currA : i18nc("@title:group Name", m_others); } } break; @@ -263,6 +260,11 @@ QVariant DolphinModel::displayRoleData(const QModelIndex& index) const } if (currentDate.year() == modifiedDate.year() && currentDate.month() == modifiedDate.month()) { + if (modifiedWeek > currentWeek) { + // use case: modified date = 2010-01-01, current date = 2010-01-22 + // modified week = 53, current week = 3 + modifiedWeek = 0; + } switch (currentWeek - modifiedWeek) { case 0: switch (daysDistance) { @@ -393,7 +395,7 @@ QVariant DolphinModel::sortRoleData(const QModelIndex& index) const retVariant = data(index, KCategorizedSortFilterProxyModel::CategoryDisplayRole); if (retVariant == i18nc("@title:group Name", m_others)) { // assure that the "Others" group is always the last categorization - retVariant = QString(QChar(QChar::ReplacementCharacter)); + retVariant = QString('Z').append(QChar::ReplacementCharacter); } break; }