00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef __recentapps_h__
00025 #define __recentapps_h__
00026
00027 #include <tqvaluelist.h>
00028
00029 class RecentlyLaunchedApps;
00030
00031 class RecentlyLaunchedAppInfo
00032 {
00033 public:
00034 RecentlyLaunchedAppInfo()
00035 {
00036 m_launchCount = 0;
00037 m_lastLaunchTime = 0;
00038 }
00039
00040 RecentlyLaunchedAppInfo(const TQString& desktopPath, int nLaunchCount, time_t lastLaunchTime)
00041 {
00042 m_desktopPath = desktopPath;
00043 m_launchCount = nLaunchCount;
00044 m_lastLaunchTime = lastLaunchTime;
00045 }
00046
00047 RecentlyLaunchedAppInfo(const RecentlyLaunchedAppInfo& clone)
00048 {
00049 m_desktopPath = clone.m_desktopPath;
00050 m_launchCount = clone.m_launchCount;
00051 m_lastLaunchTime = clone.m_lastLaunchTime;
00052 }
00053
00054 bool operator<(const RecentlyLaunchedAppInfo& rhs)
00055 {
00056
00057 return KickerSettings::recentVsOften() ?
00058 m_lastLaunchTime > rhs.m_lastLaunchTime:
00059 m_launchCount > rhs.m_launchCount;
00060 }
00061
00062 TQString getDesktopPath() const { return m_desktopPath; }
00063 int getLaunchCount() const { return m_launchCount; };
00064 time_t getLastLaunchTime() const { return m_lastLaunchTime; };
00065 void increaseLaunchCount() { m_launchCount++; };
00066 void setLaunchCount(int nLaunchCount) { m_launchCount = nLaunchCount; };
00067 void setLastLaunchTime(time_t lastLaunch) { m_lastLaunchTime = lastLaunch; };
00068
00069 private:
00070 TQString m_desktopPath;
00071 int m_launchCount;
00072 time_t m_lastLaunchTime;
00073 };
00074
00075 class RecentlyLaunchedApps
00076 {
00077 public:
00078 static RecentlyLaunchedApps& the();
00079 void init();
00080 void configChanged();
00081 void save();
00082 void clearRecentApps();
00083 void appLaunched(const TQString & strApp);
00084 void getRecentApps(TQStringList & RecentApps);
00085 void removeItem(const TQString &strName);
00086 TQString caption() const;
00087
00088 int m_nNumMenuItems;
00089 bool m_bNeedToUpdate;
00090
00091 private:
00092 TQString launchDCOPSignalSource() { return "kmenu"; }
00093 RecentlyLaunchedApps();
00094
00095 TQValueList<RecentlyLaunchedAppInfo> m_appInfos;
00096 bool m_bInitialised;
00097 };
00098
00099 #endif