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

List:       kde-commits
Subject:    KDE/kdeplasma-addons/applets/lancelot/libs/lancelot-datamodels
From:       Ivan Čukić <ivan.cukic () kde ! org>
Date:       2010-01-17 12:08:00
Message-ID: 1263730080.472749.7610.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1076049 by ivan:

BaseMergedModel d-ptr-ized
Applications refactor



 M  +2 -1      Applications.cpp  
 M  +11 -4     BaseMergedModel.cpp  
 M  +27 -1     BaseMergedModel.h  


--- trunk/KDE/kdeplasma-addons/applets/lancelot/libs/lancelot-datamodels/Applications.cpp \
#1076048:1076049 @@ -45,6 +45,7 @@
 
 Applications::Private::~Private()
 {
+    clear();
 }
 
 void Applications::Private::sycocaUpdated(const QStringList & resources)
@@ -152,7 +153,7 @@
 
 Applications::~Applications()
 {
-    d->clear();
+    delete d;
 }
 
 QString Applications::title(int index) const
--- trunk/KDE/kdeplasma-addons/applets/lancelot/libs/lancelot-datamodels/BaseMergedModel.cpp \
#1076048:1076049 @@ -26,14 +26,21 @@
 namespace Lancelot {
 namespace Models {
 
+class BaseMergedModel::Private {
+public:
+    QList < QString > modelIDs;
+};
+
 BaseMergedModel::BaseMergedModel()
-    : Lancelot::MergedActionListModel()
+    : Lancelot::MergedActionListModel(),
+      d(new Private())
 {
 
 }
 
 BaseMergedModel::~BaseMergedModel()
 {
+    delete d;
 }
 
 void BaseMergedModel::addModel(const QString & id, ActionListModel * model)
@@ -44,20 +51,20 @@
 void BaseMergedModel::addModel(const QString & id, QIcon icon,
         const QString & title, ActionListModel * model)
 {
-    m_modelIDs.append(id);
+    d->modelIDs.append(id);
     Lancelot::MergedActionListModel::addModel(icon, title, model);
 }
 
 QMimeData * BaseMergedModel::modelMimeData(int index) const
 {
-    if ((index < 0) || (index >= m_modelIDs.size())) {
+    if ((index < 0) || (index >= d->modelIDs.size())) {
         return NULL;
     }
 
     QMap < QString , QString > map;
     map["version"] = "1.0";
     map["type"]    = "list";
-    map["model"]   = m_modelIDs.at(index);
+    map["model"]   = d->modelIDs.at(index);
 
     QMimeData * data = new QMimeData();
     data->setData("text/x-lancelotpart", Serializator::serialize(map).toAscii());
--- trunk/KDE/kdeplasma-addons/applets/lancelot/libs/lancelot-datamodels/BaseMergedModel.h \
#1076048:1076049 @@ -27,20 +27,46 @@
 namespace Lancelot {
 namespace Models {
 
+/**
+ * Provides a basic implementation of Lancelot::MergedActionListModel
+ * with drag and drop support
+ */
 class LANCELOT_EXPORT BaseMergedModel: public Lancelot::MergedActionListModel {
 public:
+    /**
+     * Creates a new instance of BaseMergedModel
+     */
     BaseMergedModel();
+
+    /**
+     * Deletes this BaseMergedModel
+     */
     ~BaseMergedModel();
 
+    /**
+     * Adds a new model to the merged model
+     * @param id id of the model to be added
+     * @param icon icon of the model to be added
+     * @param title title of the model to be added
+     * @param model model to be added
+     */
     void addModel(const QString & id, QIcon icon,
             const QString & title, ActionListModel * model);
+
+    /**
+     * Adds a new model to the merged model.
+     * @param id id of the model to be added
+     * @param model model to be added
+     */
     void addModel(const QString & id, ActionListModel * model);
+
     L_Override QMimeData * modelMimeData(int index) const;
     L_Override void setModelDropActions(int index,
             Qt::DropActions & actions, Qt::DropAction & defaultAction);
 
 private:
-    QList < QString > m_modelIDs;
+    class Private;
+    Private * const d;
 };
 
 } // namespace Models


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

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