phonebookengines/cntlistmodel/inc/cntcache_p.h
changeset 47 7cbcb2896f0e
parent 46 efe85016a067
child 66 554fe4dbbb59
--- a/phonebookengines/cntlistmodel/inc/cntcache_p.h	Wed Jun 23 18:02:44 2010 +0300
+++ b/phonebookengines/cntlistmodel/inc/cntcache_p.h	Tue Jul 06 14:05:47 2010 +0300
@@ -56,6 +56,7 @@
 public:
     int cacheOrder;
     int contactId;
+    int latestRow;
     QString name;
     QString text;
     QString icons[2];
@@ -97,8 +98,8 @@
     ~CntCacheThread();
 
     void run();
-    void scheduleInfoJob(int contactId);
-    void scheduleIconJob(const QString& iconName);
+    void scheduleInfoJob(int contactId, int priority);
+    void scheduleIconJob(const QString& iconName, int priority);
     void postponeJobs();
     bool event(QEvent *event);
 
@@ -113,7 +114,13 @@
     void onInfoFieldReady(CntInfoProvider* sender, int contactId,
                           ContactInfoField field, const QString& text);
     void onIconReady(const QPixmap& pixmap, void *data, int id, int error);
-    void doAllJobs();
+    void processJobs();
+
+private:
+    int infoJobIndex(int contactId);
+    int takeNextInfoJob();
+    int iconJobIndex(QString iconName);
+    QString takeNextIconJob();
 
 private:
     QContactManager* mContactManager;       // for fetching QContact objects
@@ -124,11 +131,11 @@
 
     QMutex mJobMutex;                       // guards access to the job lists
     bool mStarted;                          // true when thread has been started
-    bool mJobLoopRunning;                   // true from when job loop event has been posted until job loop exits
+    bool mProcessingJobs;                   // true from when job loop event has been posted until job loop exits
     int mPostponeJobs;                      // set to true by client if it needs the CPU
-    QList<int> mInfoJobs;                   // list of all info jobs
+    QList< QPair<int,int> > mInfoJobs;      // list of all info jobs and their priorities
     QList<int> mCancelledInfoJobs;          // list of all cancelled info jobs
-    QList<QString> mIconJobs;               // list of all icon jobs
+    QList< QPair<QString,int> > mIconJobs;  // list of all icon jobs and their priorities
     QList<QString> mCancelledIconJobs;      // list of all cancelled icon jobs
     int mIconRequestId;                     // the id for the last request to thumbnail manager
     QString mIconRequestName;               // the name of the icon last requested from thumbnail manager