Hello Minam,

I've got some problems with your patch :

1/ Your patch refuse to build, there are some declarations not put in 
your patch.

2/ There is already an automatic update. Can you explain why you have 
made this patch ?

3/ Update *have not* to be UserProfile dependent.

4/ You've cloned the update window, why ?

5/ it seems that About's connect have been removed

https switch is a good idea.

Laurent

minam a écrit :
> # HG changeset patch
> # User bedr...@bedrich-5f0ecfa.
> # Date 1245316874 -7200
> # Node ID 28123d22f3642ae88b5c667c20ed017ef75ecc8b
> # Parent  16afed46a4e9f149a581d5bb1bfe207ed4a8844e
> Automatic updates. For more information see 
> http://trac.qutecom.org/wiki/AutomaticUpdates
>
> diff -r 16afed46a4e9 -r 28123d22f364 wengophone/resources/config/config.xml
> --- a/wengophone/resources/config/config.xml  Tue Jan 20 16:47:33 2009 -0500
> +++ b/wengophone/resources/config/config.xml  Thu Jun 18 11:21:14 2009 +0200
> @@ -110,7 +110,7 @@
>  
>  <!-- Can be one of Hidden, IconsOnly, TextUnderIcons -->
>  <general.toolbarmode><string>Hidden</string></general.toolbarmode>
> -
> +<https.updates.enabled><bool>1</bool></https.updates.enabled>
>  <ieactivex.enable><bool>1</bool></ieactivex.enable>
>  
>  <language><string>detect</string></language>
> diff -r 16afed46a4e9 -r 28123d22f364 
> wengophone/src/control/profile/CUserProfile.cpp
> --- a/wengophone/src/control/profile/CUserProfile.cpp Tue Jan 20 16:47:33 
> 2009 -0500
> +++ b/wengophone/src/control/profile/CUserProfile.cpp Thu Jun 18 11:21:14 
> 2009 +0200
> @@ -162,8 +162,8 @@
>  
>               //Check for WengoPhone update
>               if (_userProfile.getSipAccount()) {
> -                     if (_userProfile.getSipAccount()->getType() == 
> SipAccount::SipAccountTypeWengo) {
> -                             wsSoftUpdate.checkForUpdate();
> +                     if (_userProfile.getSipAccount()->getType() == 
> SipAccount::SipAccountTypeBasic) {
> +                             wsSoftUpdate.checkForUpdate(false);
>                       }
>               }
>       }
> diff -r 16afed46a4e9 -r 28123d22f364 
> wengophone/src/control/webservices/softupdate/CSoftUpdate.cpp
> --- a/wengophone/src/control/webservices/softupdate/CSoftUpdate.cpp   Tue Jan 
> 20 16:47:33 2009 -0500
> +++ b/wengophone/src/control/webservices/softupdate/CSoftUpdate.cpp   Thu Jun 
> 18 11:21:14 2009 +0200
> @@ -49,5 +49,5 @@
>  }
>  
>  void CSoftUpdate::checkForUpdate() {
> -     _wsSoftUpdate.checkForUpdate();
> +     _wsSoftUpdate.checkForUpdate(false);
>  }
> diff -r 16afed46a4e9 -r 28123d22f364 wengophone/src/model/config/Config.cpp
> --- a/wengophone/src/model/config/Config.cpp  Tue Jan 20 16:47:33 2009 -0500
> +++ b/wengophone/src/model/config/Config.cpp  Thu Jun 18 11:21:14 2009 +0200
> @@ -173,6 +173,7 @@
>  const string Config::LINUX_PREFERED_BROWSER_KEY = "linux.prefered.browser";
>  
>  const string Config::CALL_ENCRYPTION_MODE_KEY = "call.encryption.mode";
> +const string Config::HTTPS_UPDATES_ENABLED_KEY = "https.updates.enabled";
>  
>  const string Config::URL_ACCOUNTCREATION_KEY = "url.accountcreation";
>  
> @@ -759,6 +760,11 @@
>  bool Config::getCallEncryptionMode() const {
>       return getBooleanKeyValue(CALL_ENCRYPTION_MODE_KEY);
>  }
> +
> +bool Config::getHttpsUpdatesEnabled() const {
> +     return getBooleanKeyValue(HTTPS_UPDATES_ENABLED_KEY);
> +}
> +
>  string Config::getAccountCreationUrl() const {
>       return getStringKeyValue(URL_ACCOUNTCREATION_KEY);
>  }
> diff -r 16afed46a4e9 -r 28123d22f364 wengophone/src/model/config/Config.h
> --- a/wengophone/src/model/config/Config.h    Tue Jan 20 16:47:33 2009 -0500
> +++ b/wengophone/src/model/config/Config.h    Thu Jun 18 11:21:14 2009 +0200
> @@ -598,6 +598,8 @@
>       /** Call encryption mode. */
>       static const std::string CALL_ENCRYPTION_MODE_KEY;
>       bool getCallEncryptionMode() const;
> +  static const std::string HTTPS_UPDATES_ENABLED_KEY;
> +     bool getHttpsUpdatesEnabled() const;
>  
>       /** @} */
>  
> diff -r 16afed46a4e9 -r 28123d22f364 
> wengophone/src/model/profile/UserProfile.cpp
> --- a/wengophone/src/model/profile/UserProfile.cpp    Tue Jan 20 16:47:33 
> 2009 -0500
> +++ b/wengophone/src/model/profile/UserProfile.cpp    Thu Jun 18 11:21:14 
> 2009 +0200
> @@ -495,7 +495,7 @@
>                               LOG_DEBUG("SMS created");
>  
>                               //Creates SoftUpdate, SoftUpdate needs a 
> WengoAccount
> -                             _wsSoftUpdate = new WsSoftUpdate(wengoAccount);
> +                             _wsSoftUpdate = new WsSoftUpdate(wengoAccount, 
> this);
>                               wsSoftUpdateCreatedEvent(*this, *_wsSoftUpdate);
>                               LOG_DEBUG("SoftUpdate created");
>  
> @@ -508,6 +508,11 @@
>                               wsCallForwardCreatedEvent(*this, 
> *_wsCallForward);
>                               _wsCallForward->wsCallForwardEvent += 
> boost::bind(&UserProfile::wsCallForwardEventHandler, this, _1, _2, _3);
>                       }
> +                             else if (_sipAccount->getType() == 
> SipAccount::SipAccountTypeBasic) {
> +                             WengoAccount * wengoAccount = 
> dynamic_cast<WengoAccount*>(_sipAccount);
> +                             _wsSoftUpdate = new WsSoftUpdate(wengoAccount, 
> this);
> +                             wsSoftUpdateCreatedEvent(*this, *_wsSoftUpdate);
> +                     }
>                       phoneLineCreatedEvent(*this, *_activePhoneLine);
>  
>                       loadHistory(getProfileDirectory());
> @@ -625,3 +630,7 @@
>  
>       return false;
>  }
> +
> +void UserProfile::setLastRejectedUpdate(unsigned long long buildId) {
> +  _lastRejectedUpdate = buildId;
> +}
> diff -r 16afed46a4e9 -r 28123d22f364 
> wengophone/src/model/profile/UserProfile.h
> --- a/wengophone/src/model/profile/UserProfile.h      Tue Jan 20 16:47:33 
> 2009 -0500
> +++ b/wengophone/src/model/profile/UserProfile.h      Thu Jun 18 11:21:14 
> 2009 +0200
> @@ -412,6 +412,15 @@
>       std::string getName() const {
>               return _name;
>       }
> +     
> +     /**
> +   * Softupdate
> +   */
> +  unsigned long long getLastRejectedUpdate() {
> +    return _lastRejectedUpdate;
> +  }
> +  
> +  void setLastRejectedUpdate(unsigned long long buildId);
>  
>  private:
>  
> @@ -559,6 +568,9 @@
>  
>       /** Name of the UserProfile. */
>       std::string _name;
> +     
> +     /** BuildId of last rejected update */
> +     unsigned long long _lastRejectedUpdate;
>  };
>  
>  #endif       //OWUSERPROFILE_H
> diff -r 16afed46a4e9 -r 28123d22f364 
> wengophone/src/model/profile/UserProfileXMLSerializer.cpp
> --- a/wengophone/src/model/profile/UserProfileXMLSerializer.cpp       Tue Jan 
> 20 16:47:33 2009 -0500
> +++ b/wengophone/src/model/profile/UserProfileXMLSerializer.cpp       Thu Jun 
> 18 11:21:14 2009 +0200
> @@ -27,6 +27,7 @@
>  #include "UserProfile.h"
>  
>  #include <tinyxml.h>
> +#include <sstream>
>  
>  UserProfileXMLSerializer::UserProfileXMLSerializer(UserProfile & 
> userProfile) 
>  : ProfileXMLSerializer(userProfile), _userProfile(userProfile) {
> @@ -34,6 +35,8 @@
>  
>  std::string UserProfileXMLSerializer::serialize() {
>       std::string result;
> +     unsigned long long tmpLastRejectedUpdate;
> +     std::stringstream tmp;
>  
>       result += "<userprofile>\n";
>  
> @@ -48,6 +51,11 @@
>               result += sserializer.serialize();
>       }
>  
> +  result += "<updates>\n<lastrejectedupdate>";
> +  tmp << _userProfile.getLastRejectedUpdate();
> +  result += tmp.str();
> +  result += "</lastrejectedupdate>\n</updates>";
> +
>       result += "</userprofile>\n";
>  
>       return result;
> @@ -65,6 +73,16 @@
>  
>       result = ProfileXMLSerializer::unserializeContent(userprofile);
>       if (result) {
> +    // Retrieving informations for softupdate
> +       TiXmlText * text = 
> userprofile.FirstChild("updates").FirstChild("lastrejectedupdate").FirstChild().Text();
> +       unsigned long long lastRejectedUpdate;
> +       if (text) {
> +               std::stringstream ss(std::string(text->Value()));
> +               ss >> lastRejectedUpdate;
> +               _userProfile.setLastRejectedUpdate(lastRejectedUpdate);
> +       }
> +       /////
> +     
>               // Retrieving wengoaccount
>               TiXmlNode * wengoaccount = 
> userprofile.FirstChild("wengoaccount").Node();
>               if (wengoaccount) {
> diff -r 16afed46a4e9 -r 28123d22f364 
> wengophone/src/model/webservices/softupdate/WsSoftUpdate.cpp
> --- a/wengophone/src/model/webservices/softupdate/WsSoftUpdate.cpp    Tue Jan 
> 20 16:47:33 2009 -0500
> +++ b/wengophone/src/model/webservices/softupdate/WsSoftUpdate.cpp    Thu Jun 
> 18 11:21:14 2009 +0200
> @@ -31,23 +31,35 @@
>  
>  #include <sstream>
>  
> -WsSoftUpdate::WsSoftUpdate(WengoAccount * wengoAccount)
> +#include <model/profile/UserProfile.h>
> +
> +WsSoftUpdate::WsSoftUpdate(WengoAccount * wengoAccount, UserProfile * 
> userProfile)
>       : WengoWebService(wengoAccount) {
>  
>       Config & config = ConfigManager::getInstance().getCurrentConfig();
> +  _lastRejectedUpdate = userProfile->getLastRejectedUpdate();
>  
>       //Setup the web service
>       setHostname(config.getWengoServerHostname());
>       setGet(true);
> -     setHttps(true);
> +     if (config.getHttpsUpdatesEnabled()) {
> +      setHttps(true);
> +      setPort(443);
> +      }
> +     else {
> +      setHttps(false);
> +      setPort(80);
> +  }
>       setServicePath(config.getWengoSoftUpdatePath());
>       setPort(443);
>       setWengoAuthentication(false);
>  }
>  
> -void WsSoftUpdate::checkForUpdate() {
> +void WsSoftUpdate::checkForUpdate(bool forced) {
>       std::string operatingSystem;
>  
> +  forcedUpdate = forced;
> +
>  #ifdef OS_WINDOWS
>       operatingSystem = "windows";
>  #elif defined (OS_MACOSX)
> @@ -106,8 +118,9 @@
>               ss >> fileSize;
>       }
>  
> +  // Gets the last rejected update buildId from user profile
>  
> -     if ((WengoPhoneBuildId::getBuildId() != 0) && (buildId > 
> WengoPhoneBuildId::getBuildId())) {
> +     if ((WengoPhoneBuildId::getBuildId() != 0) && (buildId > 
> WengoPhoneBuildId::getBuildId()) && ((buildId > _lastRejectedUpdate) || 
> forcedUpdate)) {
>               //A new version of WengoPhone is available and we don't have a 
> developer version with buildid=0
>               LOG_DEBUG("new WengoPhone version available=" + version + " 
> buildid=" + String::fromUnsignedLongLong(buildId));
>  
> diff -r 16afed46a4e9 -r 28123d22f364 
> wengophone/src/model/webservices/softupdate/WsSoftUpdate.h
> --- a/wengophone/src/model/webservices/softupdate/WsSoftUpdate.h      Tue Jan 
> 20 16:47:33 2009 -0500
> +++ b/wengophone/src/model/webservices/softupdate/WsSoftUpdate.h      Thu Jun 
> 18 11:21:14 2009 +0200
> @@ -21,6 +21,7 @@
>  #define OWWSSOFTUPDATE_H
>  
>  #include <model/webservices/WengoWebService.h>
> +#include <model/profile/UserProfile.h>
>  
>  /**
>   * WengoPhone update web service.
> @@ -37,7 +38,7 @@
>        *
>        * @param wengoAccount the WengoAccount used for web services
>        */
> -     WsSoftUpdate(WengoAccount * wengoAccount);
> +     WsSoftUpdate(WengoAccount * wengoAccount, UserProfile * userProfile);
>  
>       virtual ~WsSoftUpdate() {}
>  
> @@ -59,14 +60,19 @@
>       /**
>        * Checks if a WengoPhone update is available.
>        */
> -     void checkForUpdate();
> +     void checkForUpdate(bool forced);
>  
>  private:
> +  //Indicates whether the update check was done automatically or by menu item
> +  bool forcedUpdate;
>  
>       /**
>        * @see WengoWebService
>        */
>       void answerReceived(const std::string & answer, int id);
> +     
> +     //BuildId of last rejected update
> +     unsigned long long _lastRejectedUpdate;
>  };
>  
>  #endif //OWWSSOFTUPDATE_H
> diff -r 16afed46a4e9 -r 28123d22f364 
> wengophone/src/presentation/qt/CMakeLists.txt
> --- a/wengophone/src/presentation/qt/CMakeLists.txt   Tue Jan 20 16:47:33 
> 2009 -0500
> +++ b/wengophone/src/presentation/qt/CMakeLists.txt   Thu Jun 18 11:21:14 
> 2009 +0200
> @@ -421,6 +421,7 @@
>       webservices/sms/SmsWindow.ui
>       webservices/softupdate/SoftUpdateWindow.ui
>       webservices/softupdate/BrowserSoftUpdateWindow.ui
> +     webservices/softupdate/DownloadUpdatesWindow.ui
>  
>       conference/ConferenceCallWidget.ui
>  
> diff -r 16afed46a4e9 -r 28123d22f364 
> wengophone/src/presentation/qt/QtToolBar.cpp
> --- a/wengophone/src/presentation/qt/QtToolBar.cpp    Tue Jan 20 16:47:33 
> 2009 -0500
> +++ b/wengophone/src/presentation/qt/QtToolBar.cpp    Thu Jun 18 11:21:14 
> 2009 +0200
> @@ -52,10 +52,12 @@
>  #include <model/phonecall/ConferenceCall.h>
>  #include <model/account/wengo/WengoAccount.h>
>  #include <model/profile/UserProfile.h>
> +#include <model/profile/UserProfileHandler.h>
>  #include <model/history/History.h>
>  #include <model/config/ConfigManager.h>
>  #include <model/config/Config.h>
>  #include <model/config/EnumToolBarMode.h>
> +#include <model/webservices/softupdate/WsSoftUpdate.h>
>  
>  #include <util/Logger.h>
>  
> @@ -134,7 +136,7 @@
>       //menuHelp
>       connectOrHide(WsUrl::Forum, _ui->actionShowWengoForum, this, 
> SLOT(showWengoForum()));
>       connectOrHide(WsUrl::FAQ, _ui->actionWengoFAQ, this, 
> SLOT(showWengoFAQ()));
> -     SAFE_CONNECT(_ui->actionShowAbout, SIGNAL(triggered()), 
> SLOT(showAbout()));
> +     SAFE_CONNECT(_ui->actionCheckForUpdates, SIGNAL(triggered()), 
> SLOT(checkForUpdates()));
>  
>       //menuTools
>       SAFE_CONNECT(_ui->actionShowConfig, SIGNAL(triggered()), 
> SLOT(showConfig()));
> @@ -289,6 +291,11 @@
>       qtAbout->getWidget()->show();
>  }
>  
> +void QtToolBar::checkForUpdates() {
> +  WsSoftUpdate * wsSoftUpdate = 
> _cWengoPhone.getCUserProfileHandler().getUserProfileHandler().getCurrentUserProfile()->getWsSoftUpdate();
> +  wsSoftUpdate->checkForUpdate(true);
> +}
> +
>  void QtToolBar::sendSms() {
>  
>       CUserProfile * cuserprofile = 
> _cWengoPhone.getCUserProfileHandler().getCUserProfile();
> diff -r 16afed46a4e9 -r 28123d22f364 
> wengophone/src/presentation/qt/QtToolBar.h
> --- a/wengophone/src/presentation/qt/QtToolBar.h      Tue Jan 20 16:47:33 
> 2009 -0500
> +++ b/wengophone/src/presentation/qt/QtToolBar.h      Thu Jun 18 11:21:14 
> 2009 +0200
> @@ -79,6 +79,8 @@
>  
>       void showAbout();
>  
> +     void checkForUpdates();
> +
>       void sendSms();
>  
>       void showWengoFAQ();
> diff -r 16afed46a4e9 -r 28123d22f364 
> wengophone/src/presentation/qt/WengoPhoneWindow.ui
> --- a/wengophone/src/presentation/qt/WengoPhoneWindow.ui      Tue Jan 20 
> 16:47:33 2009 -0500
> +++ b/wengophone/src/presentation/qt/WengoPhoneWindow.ui      Thu Jun 18 
> 11:21:14 2009 +0200
> @@ -102,6 +102,8 @@
>      <addaction name="actionShowWengoForum" />
>      <addaction name="actionWengoFAQ" />
>      <addaction name="separator" />
> +    <addaction name="actionCheckForUpdates" />
> +    <addaction name="separator" />
>      <addaction name="actionShowAbout" />
>     </widget>
>     <widget class="QMenu" name="menuActions" >
> @@ -475,6 +477,11 @@
>      <string>&amp;Hidden</string>
>     </property>
>    </action>
> +  <action name="actionCheckForUpdates" >
> +   <property name="text" >
> +    <string>Check f&amp;or Updates...</string>
> +   </property>
> +  </action>
>   </widget>
>   <customwidgets>
>    <customwidget>
> diff -r 16afed46a4e9 -r 28123d22f364 
> wengophone/src/presentation/qt/lang/qtwengophone_cs.ts
> --- a/wengophone/src/presentation/qt/lang/qtwengophone_cs.ts  Tue Jan 20 
> 16:47:33 2009 -0500
> +++ b/wengophone/src/presentation/qt/lang/qtwengophone_cs.ts  Thu Jun 18 
> 11:21:14 2009 +0200
> @@ -1109,6 +1109,35 @@
>      </message>
>  </context>
>  <context>
> +    <name>DownloadUpdatesWindow</name>
> +    <message>
> +        <location 
> filename="../webservices/softupdate/DownloadUpdatesWindow.ui" line="13"/>
> +        <source>@product@ - Update available</source>
> +        <translation>@product@ - Jsou dostupné aktualizace</translation>
> +    </message>
> +    <message>
> +        <location 
> filename="../webservices/softupdate/DownloadUpdatesWindow.ui" line="55"/>
> +        <source>An update is available. Do you want to download it?
> +
> +Version: %1
> +File Size: %2 (MB)</source>
> +        <translation>Jsou dostupné aktualizace. Chcete je nyní stáhnout?
> +
> +Verze: %1
> +Velikost souboru: %2 (MB)</translation>
> +    </message>
> +    <message>
> +        <location 
> filename="../webservices/softupdate/DownloadUpdatesWindow.ui" line="101"/>
> +        <source>Yes</source>
> +        <translation>Ano</translation>
> +    </message>
> +    <message>
> +        <location 
> filename="../webservices/softupdate/DownloadUpdatesWindow.ui" line="108"/>
> +        <source>No</source>
> +        <translation>Ne</translation>
> +    </message>
> +</context>
> +<context>
>      <name>EventWidget</name>
>      <message>
>          <location filename="../profilebar/EventWidget.ui" line="33"/>
> @@ -4545,6 +4574,11 @@
>          <translation>&amp;O aplikaci</translation>
>      </message>
>      <message>
> +        <location filename="../WengoPhoneWindow.ui" line="519"/>
> +        <source>Check f&amp;or Updates...</source>
> +        <translation>Zk&amp;ontrolovat aktualizace</translation>
> +    </message>
> +    <message>
>          <location filename="../WengoPhoneWindow.ui" line="241"/>
>          <source>Add &amp;Contact...</source>
>          <translation>Přidat &amp;kontakt...</translation>
> diff -r 16afed46a4e9 -r 28123d22f364 
> wengophone/src/presentation/qt/webservices/softupdate/DownloadUpdatesWindow.ui
> --- /dev/null Thu Jan 01 00:00:00 1970 +0000
> +++ 
> b/wengophone/src/presentation/qt/webservices/softupdate/DownloadUpdatesWindow.ui
>   Thu Jun 18 11:21:14 2009 +0200
> @@ -0,0 +1,170 @@
> +<ui version="4.0" >
> + <class>DownloadUpdatesWindow</class>
> + <widget class="QDialog" name="DownloadUpdatesWindow" >
> +  <property name="geometry" >
> +   <rect>
> +    <x>0</x>
> +    <y>0</y>
> +    <width>365</width>
> +    <height>131</height>
> +   </rect>
> +  </property>
> +  <property name="windowTitle" >
> +   <string>@product@ - Update available</string>
> +  </property>
> +  <property name="sizeGripEnabled" >
> +   <bool>false</bool>
> +  </property>
> +  <layout class="QVBoxLayout" name="verticalLayout" >
> +   <item>
> +    <layout class="QGridLayout" name="gridLayout" >
> +     <property name="sizeConstraint" >
> +      <enum>QLayout::SetDefaultConstraint</enum>
> +     </property>
> +     <property name="spacing" >
> +      <number>6</number>
> +     </property>
> +     <item row="0" column="0" >
> +      <widget class="QLabel" name="label_2" >
> +       <property name="sizePolicy" >
> +        <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
> +         <horstretch>0</horstretch>
> +         <verstretch>0</verstretch>
> +        </sizepolicy>
> +       </property>
> +       <property name="text" >
> +        <string/>
> +       </property>
> +       <property name="pixmap" >
> +        <pixmap resource="../../../../../resources/wengophone.qrc" 
> >:/pics/update.png</pixmap>
> +       </property>
> +       <property name="scaledContents" >
> +        <bool>false</bool>
> +       </property>
> +      </widget>
> +     </item>
> +     <item row="0" column="1" >
> +      <widget class="QLabel" name="updateTextLabel" >
> +       <property name="sizePolicy" >
> +        <sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
> +         <horstretch>0</horstretch>
> +         <verstretch>0</verstretch>
> +        </sizepolicy>
> +       </property>
> +       <property name="text" >
> +        <string>An update is available. Do you want to download it?
> +
> +Version: %1
> +File Size: %2 (MB)</string>
> +       </property>
> +       <property name="textFormat" >
> +        <enum>Qt::PlainText</enum>
> +       </property>
> +       <property name="alignment" >
> +        <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
> +       </property>
> +       <property name="indent" >
> +        <number>10</number>
> +       </property>
> +      </widget>
> +     </item>
> +    </layout>
> +   </item>
> +   <item>
> +    <spacer name="verticalSpacer" >
> +     <property name="orientation" >
> +      <enum>Qt::Vertical</enum>
> +     </property>
> +     <property name="sizeHint" stdset="0" >
> +      <size>
> +       <width>20</width>
> +       <height>8</height>
> +      </size>
> +     </property>
> +    </spacer>
> +   </item>
> +   <item>
> +    <layout class="QHBoxLayout" name="horizontalLayout" >
> +     <item>
> +      <spacer name="horizontalSpacer" >
> +       <property name="orientation" >
> +        <enum>Qt::Horizontal</enum>
> +       </property>
> +       <property name="sizeHint" stdset="0" >
> +        <size>
> +         <width>40</width>
> +         <height>20</height>
> +        </size>
> +       </property>
> +      </spacer>
> +     </item>
> +     <item>
> +      <widget class="QPushButton" name="yesButton" >
> +       <property name="text" >
> +        <string>Yes</string>
> +       </property>
> +      </widget>
> +     </item>
> +     <item>
> +      <widget class="QPushButton" name="noButton" >
> +       <property name="text" >
> +        <string>No</string>
> +       </property>
> +      </widget>
> +     </item>
> +     <item>
> +      <spacer name="horizontalSpacer_2" >
> +       <property name="orientation" >
> +        <enum>Qt::Horizontal</enum>
> +       </property>
> +       <property name="sizeHint" stdset="0" >
> +        <size>
> +         <width>40</width>
> +         <height>20</height>
> +        </size>
> +       </property>
> +      </spacer>
> +     </item>
> +    </layout>
> +   </item>
> +  </layout>
> + </widget>
> + <resources>
> +  <include location="../../../../../resources/wengophone.qrc" />
> +  <include 
> location="../../../../../../../../../../../resources/wengophone.qrc" />
> + </resources>
> + <connections>
> +  <connection>
> +   <sender>yesButton</sender>
> +   <signal>clicked()</signal>
> +   <receiver>DownloadUpdatesWindow</receiver>
> +   <slot>accept()</slot>
> +   <hints>
> +    <hint type="sourcelabel" >
> +     <x>140</x>
> +     <y>190</y>
> +    </hint>
> +    <hint type="destinationlabel" >
> +     <x>182</x>
> +     <y>135</y>
> +    </hint>
> +   </hints>
> +  </connection>
> +  <connection>
> +   <sender>noButton</sender>
> +   <signal>clicked()</signal>
> +   <receiver>DownloadUpdatesWindow</receiver>
> +   <slot>reject()</slot>
> +   <hints>
> +    <hint type="sourcelabel" >
> +     <x>225</x>
> +     <y>190</y>
> +    </hint>
> +    <hint type="destinationlabel" >
> +     <x>182</x>
> +     <y>135</y>
> +    </hint>
> +   </hints>
> +  </connection>
> + </connections>
> +</ui>
> diff -r 16afed46a4e9 -r 28123d22f364 
> wengophone/src/presentation/qt/webservices/softupdate/QtSoftUpdate.cpp
> --- a/wengophone/src/presentation/qt/webservices/softupdate/QtSoftUpdate.cpp  
> Tue Jan 20 16:47:33 2009 -0500
> +++ b/wengophone/src/presentation/qt/webservices/softupdate/QtSoftUpdate.cpp  
> Thu Jun 18 11:21:14 2009 +0200
> @@ -20,6 +20,7 @@
>  #include "QtSoftUpdate.h"
>  
>  #include "ui_SoftUpdateWindow.h"
> +#include "ui_DownloadUpdatesWindow.h"
>  
>  #include "QtBrowserSoftUpdate.h"
>  
> @@ -39,6 +40,10 @@
>  
>  #include <QtGui/QtGui>
>  
> +#include <model/profile/UserProfileHandler.h>
> +#include <control/profile/CUserProfileHandler.h>
> +#include <model/profile/UserProfile.h>
> +
>  static const char * UPDATE_PROGRAM = "update.exe";
>  
>  QtSoftUpdate::QtSoftUpdate(CSoftUpdate & cSoftUpdate)
> @@ -82,35 +87,28 @@
>                               const std::string & version,
>                               unsigned fileSize) {
>  
> -#ifdef OS_WINDOWS
> -     _softUpdateWindow = new QDialog(_qtWengoPhone->getWidget());
> +  updDownloadUrl = downloadUrl;
> +  updBuildId = buildId;
> +  updVersion = version;
> +  updFileSize = fileSize;
> + 
> +  _downloadUpdatesWindow = new QDialog(_qtWengoPhone->getWidget());
> +  
> +     _uiDownload = new Ui::DownloadUpdatesWindow();
> +     _uiDownload->setupUi(_downloadUpdatesWindow);
> + 
> +     SAFE_CONNECT(_downloadUpdatesWindow, SIGNAL(accepted()), 
> SLOT(startDownload()));
> +     SAFE_CONNECT(_downloadUpdatesWindow, SIGNAL(rejected()), 
> SLOT(rejectUpdate()));
> +     
>  
> -     _ui = new Ui::SoftUpdateWindow();
> -     _ui->setupUi(_softUpdateWindow);
> -
> -     SAFE_CONNECT(_softUpdateWindow, SIGNAL(rejected()), 
> SLOT(abortDownload()));
> -
> +     
>       //updateTextLabel
> -     _originalLabelText = _ui->updateTextLabel->text()
> -                             .arg(QString::fromStdString(version))
> -                             .arg(QString::fromStdString(downloadUrl))
> -                             .arg(fileSize);
> -     _ui->updateTextLabel->setText(_originalLabelText);
> -
> -     //Deletes previous update program
> -     QFile file(UPDATE_PROGRAM);
> -     file.remove();
> -     file.close();
> -
> -     _softUpdater = new SoftUpdater(downloadUrl, UPDATE_PROGRAM);
> -     _softUpdater->dataReadProgressEvent += 
> boost::bind(&QtSoftUpdate::dataReadProgressEventHandler, this, _1, _2, _3);
> -     _softUpdater->downloadFinishedEvent += 
> boost::bind(&QtSoftUpdate::downloadFinishedEventHandler, this, _1);
> -     _softUpdater->start();
> -
> -     _softUpdateWindow->exec();
> -#else
> -     QtBrowserSoftUpdate(downloadUrl, buildId, version, fileSize, 
> _qtWengoPhone->getWidget());
> -#endif
> +     _originalLabelText = _uiDownload->updateTextLabel->text()
> +                             .arg(QString::fromStdString(updVersion))
> +                             .arg(updFileSize);
> +     _uiDownload->updateTextLabel->setText(_originalLabelText);
> +  
> +  _downloadUpdatesWindow->exec();
>  }
>  
>  void QtSoftUpdate::dataReadProgressEventHandler(double bytesDone, double 
> bytesTotal, unsigned downloadSpeed) {
> @@ -151,10 +149,47 @@
>       }
>  }
>  
> +void QtSoftUpdate::rejectUpdate() {
> +  UserProfile * userprofile = 
> _cSoftUpdate.getCWengoPhone().getCUserProfileHandler().getUserProfileHandler().getCurrentUserProfile();
> +  userprofile->setLastRejectedUpdate(updBuildId);
> +}
> +
>  void QtSoftUpdate::abortDownload() {
>       _softUpdater->abort();
>  }
>  
> +void QtSoftUpdate::startDownload() {
> +#ifdef OS_WINDOWS
> +     _softUpdateWindow = new QDialog(_qtWengoPhone->getWidget());
> +
> +     _ui = new Ui::SoftUpdateWindow();
> +     _ui->setupUi(_softUpdateWindow);
> +
> +     SAFE_CONNECT(_softUpdateWindow, SIGNAL(rejected()), 
> SLOT(abortDownload()));
> +
> +     //updateTextLabel
> +     _originalLabelText = _ui->updateTextLabel->text()
> +                             .arg(QString::fromStdString(updVersion))
> +                             .arg(QString::fromStdString(updDownloadUrl))
> +                             .arg(updFileSize);
> +     _ui->updateTextLabel->setText(_originalLabelText);
> +
> +     //Deletes previous update program
> +     QFile file(UPDATE_PROGRAM);
> +     file.remove();
> +     file.close();
> +
> +     _softUpdater = new SoftUpdater(updDownloadUrl, UPDATE_PROGRAM);
> +     _softUpdater->dataReadProgressEvent += 
> boost::bind(&QtSoftUpdate::dataReadProgressEventHandler, this, _1, _2, _3);
> +     _softUpdater->downloadFinishedEvent += 
> boost::bind(&QtSoftUpdate::downloadFinishedEventHandler, this, _1);
> +     _softUpdater->start();
> +
> +     _softUpdateWindow->exec();
> +#else
> +     QtBrowserSoftUpdate(downloadUrl, buildId, version, fileSize, 
> _qtWengoPhone->getWidget());
> +#endif
> +}
> +
>  void QtSoftUpdate::launchUpdateProcess() {
>       QProcess * updateProcess = new QProcess();
>       SAFE_CONNECT(updateProcess, SIGNAL(error(QProcess::ProcessError)), 
> SLOT(updateProcessError(QProcess::ProcessError)));
> _______________________________________________
> QuteCom-dev mailing list
> [email protected]
> http://lists.qutecom.org/mailman/listinfo/qutecom-dev
>   

_______________________________________________
QuteCom-dev mailing list
[email protected]
http://lists.qutecom.org/mailman/listinfo/qutecom-dev

Reply via email to