[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/knewstuff/knewstuff3
From:       Frederik Gladhorn <gladhorn () kde ! org>
Date:       2009-11-28 0:14:01
Message-ID: 1259367241.637431.18251.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1055419 by gladhorn:

acutally also post the price that was set to the server
make it possible to exit the dialog after upload
get rid of a message box that says nothing


 M  +36 -10    uploaddialog.cpp  
 M  +2 -0      uploaddialog.h  
 M  +7 -4      uploaddialog.ui  


--- trunk/KDE/kdelibs/knewstuff/knewstuff3/uploaddialog.cpp #1055418:1055419
@@ -66,6 +66,12 @@
         QStringList categoryNames;
         QString contentId;
         KWallet::Wallet* wallet;
+        bool finished;
+
+        Private()
+            :finished(false)
+        {
+        }
     };
 }
 
@@ -152,12 +158,17 @@
 
     kDebug() << "Categories: " << d->categoryNames;
 
-    //d->providerFileUrl = group.readEntry("ProvidersUrl", QString());
-    //d->applicationName = QFileInfo(KStandardDirs::locate("config", \
configfile)).baseName() + ':'; +    connect(d->ui.priceCheckBox, \
SIGNAL(toggled(bool)), this, SLOT(priceToggled(bool)));  
     return true;
 }
 
+void UploadDialog::priceToggled(bool priceEnabled)
+{
+    d->ui.priceLabel->setEnabled(priceEnabled);
+    d->ui.priceSpinBox->setEnabled(priceEnabled);
+}
+
 void UploadDialog::providerAdded(const Attica::Provider& provider)
 {
     // we only care about opendesktop for now
@@ -191,6 +202,11 @@
 
 void UploadDialog::accept()
 {
+    if (d->finished) {
+        KDialog::accept();
+        return;
+    }
+
     if (!d->provider.isValid()) {
         KMessageBox::error(this, i18n("Provider could not be initialized."));
         return;
@@ -215,15 +231,23 @@
     content.addAttribute("version", d->ui.mVersionEdit->text());
     content.addAttribute("license", d->ui.mLicenseCombo->currentText());
 
+    // TODO: add additional attributes
+    //content.addAttribute("changelog", ui.changelog->text());
+    //content.addAttribute("downloadlink1", ui.link1->text());
+    //content.addAttribute("downloadlink2", ui.link2->text());
+    //content.addAttribute("homepage1", ui.homepage->text());
+    //content.addAttribute("blog1", ui.blog->text());
+
+    if (d->ui.priceCheckBox->isChecked()) {
+        content.addAttribute("downloadbuy1", "1");
+        content.addAttribute("downloadbuyprice1", \
QString::number(d->ui.priceSpinBox->value())); +        // TODO in the next version:
+        // content.addAttribute("downloadbuyreason1", "the description why is \
content is not for free"); +    }
+
     Attica::ItemPostJob<Attica::Content>* job = \
                d->provider.addNewContent(d->categories.first(), content);
     connect(job, SIGNAL(finished(Attica::BaseJob*)), \
SLOT(contentAdded(Attica::BaseJob*)));  job->start();
-
-    /*
-    details.insert("user", m_settingsWidget.userEdit->text());
-    details.insert("password", m_settingsWidget.passwordEdit->text());
-    m_wallet->writeMap(m_provider.baseUrl().toString(), details);
-    */
 }
 
 void UploadDialog::previewChanged(const KUrl& url)
@@ -252,7 +276,8 @@
 
     Attica::ItemPostJob<Attica::Content> * job = \
static_cast<Attica::ItemPostJob<Attica::Content> *>(baseJob);  QString id = \
                job->result().id();
-    QMessageBox::information(0, i18n("Content Added"), id);
+    //QMessageBox::information(0, i18n("Content Added"), id);
+    kDebug() << "content added " << id;
 
     d->contentId = id;
 
@@ -295,7 +320,8 @@
 {
     KMessageBox::information(0, i18n("Content Added"), i18n("File Uploaded"));
     d->ui.mProgress->setVisible(false);
-
+    d->finished = true;
+    setButtons(KDialog::Ok);
 }
 
 
--- trunk/KDE/kdelibs/knewstuff/knewstuff3/uploaddialog.h #1055418:1055419
@@ -90,6 +90,8 @@
 
     void previewChanged(const KUrl&);
 
+    void priceToggled(bool);
+
 private:
     bool init(const QString &configfile);
 
--- trunk/KDE/kdelibs/knewstuff/knewstuff3/uploaddialog.ui #1055418:1055419
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>306</width>
-    <height>374</height>
+    <width>347</width>
+    <height>454</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -228,10 +228,13 @@
         <property name="singleStep">
          <double>0.010000000000000</double>
         </property>
+        <property name="value">
+         <double>1.000000000000000</double>
+        </property>
        </widget>
       </item>
       <item row="6" column="0">
-       <widget class="QLabel" name="label">
+       <widget class="QLabel" name="priceLabel">
         <property name="enabled">
          <bool>false</bool>
         </property>
@@ -252,7 +255,7 @@
       <number>0</number>
      </property>
      <property name="value">
-      <number>107558</number>
+      <number>120251</number>
      </property>
     </widget>
    </item>


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic