]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinmodel.cpp
Reset the location to the home URL, if a place has been removed (e. g. a DVD has...
[dolphin.git] / src / dolphinmodel.cpp
index 3467c8a3822056df2905fcbe28a79f9a5c851ba2..d81e0c38b9fc0608fe5d952d42ea1afa92ae9377 100644 (file)
 #include <QDir>
 #include <QFileInfo>
 
-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()
@@ -112,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<const KDirModel*>(index.model());
+           KFileItem item = dirModel->itemForIndex(index);            
+           return item.linkDest();
+       }
+       
         break;
 
     default:
@@ -124,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();
 }
@@ -251,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) {