[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    playground/pim/kcall/kcall
From:       Tobias Hunger <tobias.hunger () basyskom ! de>
Date:       2007-07-23 12:07:31
Message-ID: 1185192451.829095.9306.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 691314 by hunger:

Update historymodel.


 M  +37 -8     historymodel.cpp  
 M  +4 -2      historymodel.h  


--- trunk/playground/pim/kcall/kcall/historymodel.cpp #691313:691314
@@ -34,6 +34,7 @@
 #include <kdebug.h>
 #include <kstandarddirs.h>
 #include <kiconloader.h>
+#include <klocale.h>
 
 #include <QString>
 #include <QList>
@@ -149,15 +150,11 @@
 }
 
 
-int HistoryModel::rowCount(const QModelIndex /* parent */) const
-{
-    return d->entries.size();
-}
+int HistoryModel::rowCount(const QModelIndex & /* parent */) const
+{ return d->entries.size(); }
 
-int HistoryModel::columnCount(const QModelIndex /* parent */) const
-{
-    return COLUMN_MAX;
-}
+int HistoryModel::columnCount(const QModelIndex & /* parent */) const
+{ return COLUMN_MAX; }
 
 QVariant HistoryModel::data(const QModelIndex & index,
                             int role) const
@@ -217,6 +214,38 @@
     return QVariant();
 }
 
+QVariant HistoryModel::headerData (int section, Qt::Orientation orientation,
+                                   int role) const
+{
+    if (Qt::DisplayRole != role) { return QVariant(); }
+    if (orientation == Qt::Horizontal)
+    {
+        switch (section)
+        {
+        case CALL_ID:
+            return QVariant(i18n("Call ID"));
+        case CALLER_NR:
+            return QVariant(i18n("Number"));
+        case CALLER_NAME:
+            return QVariant(i18n("Name"));
+        case SUBJECT:
+            return QVariant(i18n("Subject"));
+        case STATUS:
+            return QVariant(i18n("Status"));
+        case DATE:
+            return QVariant(i18n("Date"));
+        case TIME:
+            return QVariant(i18n("Time"));
+        case DURATION:
+            return QVariant(i18n("Duration"));
+        default:
+            return QVariant();
+        }
+    }
+    else
+    { return QVariant(QString::number(section)); }
+}
+
 // Custom methods:
 
 void HistoryModel::setCallerName(const int row, const QString & name)
--- trunk/playground/pim/kcall/kcall/historymodel.h #691313:691314
@@ -44,9 +44,11 @@
         ~HistoryModel();
 
         // QtAbstractTableModel implementation:
-        int rowCount(const QModelIndex parent = QModelIndex()) const;
-        int columnCount(const QModelIndex parent = QModelIndex()) const;
+        int rowCount(const QModelIndex & parent = QModelIndex()) const;
+        int columnCount(const QModelIndex & parent = QModelIndex()) const;
         QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
+        QVariant headerData (int section, Qt::Orientation orientation,
+                             int role = Qt::DisplayRole ) const;
 
         // Custom methods:
         /**
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic