diff -r 6aeb7a756187 -r 3c88a81ff781 utilities/downloadmanager/inc/downloadinfo.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/downloadmanager/inc/downloadinfo.h Fri Oct 15 17:30:59 2010 -0400
@@ -0,0 +1,149 @@
+/**
+ This file is part of CWRT package **
+
+ Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU (Lesser) General Public License as
+ published by the Free Software Foundation, version 2.1 of the License.
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ (Lesser) General Public License for more details. You should have
+ received a copy of the GNU (Lesser) General Public License along
+ with this program. If not, see .
+*/
+
+#ifndef DOWNLOAD_INFO_H
+#define DOWNLOAD_INFO_H
+
+#include "dmpimpl.h"
+#include "dmcommon.h"
+#include
+#include
+#include
+
+// forward declarations
+class QSettings;
+class DownloadInfoPrivate;
+
+// class declaration
+class DownloadInfo
+{
+ DM_DECLARE_PRIVATE(DownloadInfo); // private implementation
+public:
+ /*
+ InfoKey - key enumerations for the download info
+ */
+ enum Key
+ {
+ EUrl = 0, // 0 http://xyz.com/a.mp3
+ EFileName, // 1 a.mp3
+ ETempPath, // 2 ./com.nokia.browser/
+ EFinalPath, // 3 /home/downloads/
+ ETempFullPath, // 4 ./com.nokia.browser/a(1).mp3
+ ETotalSize, // 5 xxx bytes
+ EDlState, // 6 int
+ EContentType, // 7 audio/mp3
+ EETag, // 8 ETag
+ EChildIdList, // 9 list of child ids
+ EType, // 10 sequential or parallel
+ EScope, // 11 client side or background download
+ EPriority // 12 priority of the download
+ };
+
+ DownloadInfo(const QString& aClientName);
+ ~DownloadInfo();
+
+public:
+ /*
+ Sets a string value.
+ Returns : 0 on success, non zero on error
+ */
+ int setValue(int aDlId, Key aKeyStr, const QString& aStrValue, int aParentId = INVALID_DL_ID);
+
+ /*
+ Sets a string value.
+ Returns : 0 on success, non zero on error
+ */
+ int setValue(int aDlId, Key aKeyStr, long aLongValue, int aParentId = INVALID_DL_ID);
+
+ /*
+ Sets a string value.
+ Returns : 0 on success, non zero on error
+ */
+ int setValueForChild(int aDlId, Key aKeyStr, const QString& aStrValue, int aChildId = INVALID_DL_ID);
+
+ /*
+ Sets an int value.
+ Returns : 0 on success, non zero on error
+ */
+ int setValueForChild(int aDlId, Key aKeyInt, long aLongValue, int aChildId = INVALID_DL_ID);
+
+ /*
+ Sets the mediaObject list
+ Returns : 0 on success, non zero on error
+ */
+ int setValue(int aDlId, Key aKey, const QList& aChildIds);
+
+ /*
+ Updates(serializes) the info with all set values at once.
+ Returns : 0 on success, non zero on error
+ */
+ int update();
+
+ /*
+ Retrieves the string value
+ Returns : 0 on success, non zero on error
+ */
+ int getValue(int aDlId, Key aKeyStr, QString& aStrValue, int aParentId = INVALID_DL_ID);
+
+ /*
+ Retrieves the int value
+ Returns : 0 on success, non zero on error
+ */
+ int getValue(int aDlId, Key aKeyInt, long& aLongValue, int aParentId = INVALID_DL_ID);
+
+ /*
+ Retrieves the string value
+ Returns : 0 on success, non zero on error
+ */
+ int getValueForChild(int aDlId, Key aKeyStr, QString& aStrValue, int aChildId = INVALID_DL_ID);
+
+ /*
+ Retrieves the int value
+ Returns : 0 on success, non zero on error
+ */
+ int getValueForChild(int aDlId, Key aKeyInt, long& aLongValue, int aChildId = INVALID_DL_ID);
+
+ /*
+ Retrieves the mediaObject list
+ Returns : 0 on success, non zero on error
+ */
+ int getValue(int aParentId, Key aKey, QList& aChildIds);
+
+ /*
+ Deletes the download info of a particular download represented by aDlId.
+ Returns : 0 on success, non zero on error
+ */
+ int remove(int aDlId, int aParentId = INVALID_DL_ID);
+
+ /*
+ Returns all download ids in a vector
+ */
+ static QVector getAllDownloads(const QString& aClientName);
+
+private:
+
+ /*
+ Helper function to generate a string key combining dlId and the InfoKey
+ */
+ QString genStrKey(int aDlId, Key aKey);
+
+ /*
+ Helper function to generate a string key combining parentId, childId and the InfoKey
+ */
+ QString genStrKey(int aParentId, int aChildId, Key aKey);
+};
+
+#endif