[Release] wrt-installer_0.1.23
[framework/web/wrt-installer.git] / src / misc / widget_location.h
index 3a9c152..70c186a 100644 (file)
  *                               \___ [widgets_archive_content]
  *
  * 1) Normal Widget
- *  Developer provides content of res/wgt directory (package contains that directory as root).
+ *  Developer provides content of res/wgt directory (package contains that
+ * directory as root).
  *
  * 2) For OSP Service Hybrid App is actually a bit different:
  *  Root is OSP Service directory, WebApp content is located in [root]/res/wgt
  *
  * Temporary directory is directory when widget is placed at the begining
- * of installation process. After parsing process of config.xml, destination directory is created.
+ * of installation process. After parsing process of config.xml, destination
+ * directory is created.
  */
 class WidgetLocation
 {
     class DirectoryDeletor
     {
-    public:
+      public:
         DirectoryDeletor();
         DirectoryDeletor(std::string tempPath);
         ~DirectoryDeletor();
         std::string getTempPath() const;
-    private:
+
+      private:
         std::string m_dirpath;
     };
 
-public:
+  public:
     DECLARE_EXCEPTION_TYPE(DPL::Exception, Base)
     DECLARE_EXCEPTION_TYPE(Base, NoTemporaryPath)
     /**
@@ -76,15 +79,17 @@ public:
      */
     WidgetLocation();
     /**
-     * @brief WidgetLocation Builds paths for widget location during uninstallation
+     * @brief WidgetLocation Builds paths for widget location during
+     * uninstallation
      *
      * Uninstallation process needs only installed package directory.
      *
      * @param widgetname name of widget
      */
-    WidgetLocation(const std::string & widgetname);
+    explicit WidgetLocation(const std::string & widgetname);
     /**
-     * @brief WidgetLocation Builds paths for widget location during installation
+     * @brief WidgetLocation Builds paths for widget location during
+     * installation
      *
      * @param widgetname name of widget
      * @param sourcePath given source path
@@ -95,34 +100,34 @@ public:
     WidgetLocation(const std::string & widgetname, std::string sourcePath,
                    WrtDB::PackagingType t = WrtDB::PKG_TYPE_NOMAL_WEB_APP,
                    InstallLocationType ltype =
-                        INSTALL_LOCATION_TYPE_NOMAL);
+                       INSTALL_LOCATION_TYPE_NOMAL);
 
     WidgetLocation(const std::string & widgetname, std::string sourcePath,
                    std::string dirPath,
                    WrtDB::PackagingType t = WrtDB::PKG_TYPE_NOMAL_WEB_APP,
                    InstallLocationType ltype =
-                        INSTALL_LOCATION_TYPE_NOMAL);
+                       INSTALL_LOCATION_TYPE_NOMAL);
 
     ~WidgetLocation();
 
     // Installed paths
-    std::string getInstallationDir() const;              // /opt/apps or /usr/apps
-    std::string getPackageInstallationDir() const;       // /opt/apps/[package]
-    std::string getSourceDir() const;                    // /opt/apps/[package]/res/wgt
-    std::string getBinaryDir() const;                    // /opt/apps/[package]/bin
-    std::string getExecFile() const;                    // /opt/apps/[package]/bin/[package]
-    std::string getBackupDir() const;                    // /opt/apps/[package]/backup
-    std::string getBackupSourceDir() const;              // /opt/apps/[package]/backup/res/wgt
-    std::string getBackupBinaryDir() const;              // /opt/apps/[package]/backup/bin
-    std::string getBackupExecFile() const;              // /opt/apps/[package]/backup/bin/[package]
-    std::string getUserDataRootDir() const;             // /opt/usr/apps/[package]
-    std::string getPrivateStorageDir() const;                 // /opt/usr/apps/[package]/data
-    std::string getShareDir() const;                    // /opt/usr/apps/[package]/share
+    std::string getInstallationDir() const; // /opt/apps or /usr/apps
+    std::string getPackageInstallationDir() const; // /opt/apps/[package]
+    std::string getSourceDir() const;  // /opt/apps/[package]/res/wgt
+    std::string getBinaryDir() const;  // /opt/apps/[package]/bin
+    std::string getExecFile() const;   // /opt/apps/[package]/bin/[package]
+    std::string getBackupDir() const;  // /opt/apps/[package]/backup
+    std::string getBackupSourceDir() const; // /opt/apps/[pkg]/backup/res/wgt
+    std::string getBackupBinaryDir() const; // /opt/apps/[pkg]/backup/bin
+    std::string getBackupExecFile() const;  // /opt/apps/[pkg]/backup/bin/[pkg]
+    std::string getUserDataRootDir() const; // /opt/usr/apps/[package]
+    std::string getPrivateStorageDir() const; // /opt/usr/apps/[package]/data
 
     // Temporary paths
     /**
      * @brief getTemporaryRootDir
-     * @return value of root for developer's provide package (root of unpacked .wgt file)
+     * @return value of root for developer's provide package (root of unpacked
+     * .wgt file)
      */
     std::string getTemporaryPackageDir() const;
     /**
@@ -130,14 +135,17 @@ public:
      *
      * Value of this will differs according to type of installed widget.
      *
-     * @return value of root for content in temporary directory to be copied into 'res/wgt'
+     * @return value of root for content in temporary directory to be copied
+     * into 'res/wgt'
      */
     std::string getTemporaryRootDir() const;
     /**
-     * @brief getConfigurationDir Returns rott directory for configuration requirements
+     * @brief getConfigurationDir Returns rott directory for configuration
+     * requirements
      *
      * 1) For packed widgets it is just root of unpacked sources
-     * 2) For browser installation it is directory name of widget passed to installer
+     * 2) For browser installation it is directory name of widget passed to
+     * installer
      *
      * @return configuration directory
      */
@@ -145,16 +153,12 @@ public:
 
     //icons
     /**
-     * @brief setIconTargetFilenameForLocale set installed ion path according to locale
+     * @brief setIconTargetFilenameForLocale set installed ion path according to
+     * locale
      * @param icon path of application icon
      */
     void setIconTargetFilenameForLocale(const std::string &icon);
-    /**
-     * @brief getIconTargetFilename gets icon path suffix for locale
-     * @param languageTag language tag
-     * @return value of suffix of path
-     */
-    DPL::String getIconTargetFilename(const DPL::String& languageTag) const;
+
     /**
      * @brief getIconTargetFilename gets icon full path
      * @param languageTag language tag
@@ -188,9 +192,16 @@ public:
      */
     WrtDB::ExternalLocationList listExternalLocations() const;
 
-private:
-    std::string m_widgetSource;                   // Source widget zip file/widget url
+    /*
+     * @brief set appid
+     */
+    void registerAppid(const std::string & appid);
+
+  private:
     std::string m_pkgid;                        //id of package
+    std::string m_widgetSource;                   // Source widget zip
+                                                  // file/widget url
+    std::string m_appid;                        //id of app
     std::string m_iconPath;                       //installed icon path
     WrtDB::PackagingType m_type;
     std::shared_ptr<DirectoryDeletor> m_temp;      //directory