[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:       2010-03-15 16:22:25
Message-ID: 1268670145.172334.5799.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1103668 by gladhorn:

show website linke after upload
clean up final page for uploads


 M  +40 -9     uploaddialog.cpp  
 M  +1 -4      uploaddialog.h  
 M  +181 -42   uploaddialog.ui  
 M  +3 -0      uploaddialog_p.h  


--- trunk/KDE/kdelibs/knewstuff/knewstuff3/uploaddialog.cpp #1103667:1103668
@@ -94,7 +94,6 @@
         if (ui.radioUpdate->isChecked()) {
             // Fetch
             Attica::ItemJob<Attica::Content> *contentJob = \
currentProvider().requestContent(ui.userContentList->currentItem()->data(Qt::UserRole).toString());
                
-            kDebug() << "get contents... " << \
                ui.userContentList->currentItem()->data(Qt::UserRole).toString();
             q->connect(contentJob, SIGNAL(finished(Attica::BaseJob*)), q, \
SLOT(_k_updatedContentFetched(Attica::BaseJob*)));  contentJob->start();
 
@@ -103,6 +102,13 @@
 
         ui.mNameEdit->setFocus();
         break;
+
+    case UploadFinalPage:
+        if (previewFile.isEmpty()) {
+            ui.uploadPreviewImageLabel->setVisible(false);
+            ui.uploadPreviewLabel->setVisible(false);
+        }
+        break;
     }
 
     _k_updatePage();
@@ -267,6 +273,10 @@
     } else {
         ui.mLicenseCombo->setEditText(content.license());
     }
+
+    ui.contentWebsiteLink->setText(QLatin1String("<a href=\"") + \
content.detailpage().toString() + QLatin1String("\">") +                              \
+ i18nc("A link to the website where the get hot new stuff upload can be seen", \
"Visit website") + QLatin1String("</a>")); +    \
ui.fetchContentLinkImageLabel->setPixmap(KIcon("dialog-ok").pixmap(16));  }
 
 void UploadDialog::Private::_k_updateContentsToggled(bool update)
@@ -518,8 +528,6 @@
         return;
     }
 
-    ui.mProgressLabel->setText(i18n("Creating Content on Server..."));
-
     // fill in the content object
     Attica::Content content;
     content.setName(ui.mNameEdit->text());
@@ -583,6 +591,8 @@
         return;
     }
 
+    ui.createContentImageLabel->setPixmap(KIcon("dialog-ok").pixmap(16));
+
     Attica::ItemPostJob<Attica::Content> * job = \
static_cast<Attica::ItemPostJob<Attica::Content> *>(baseJob);  QString id = \
job->result().id();  
@@ -590,13 +600,15 @@
 
     contentId = id;
 
-    ui.mProgressLabel->setText(ui.mProgressLabel->text() + '\n' + i18n("Uploading \
content..."));  doUpload(QString(), uploadFile.toLocalFile());
 
     if (!previewFile.isEmpty()) {
-        ui.mProgressLabel->setText(ui.mProgressLabel->text() + '\n' + \
i18n("Uploading preview image and content..."));  doUpload("1", \
previewFile.toLocalFile());  }
+
+    if (ui.radioNewUpload->isChecked()) {
+        fetchDownloadLink(contentId);
+    }
 }
 
 void UploadDialog::Private::doUpload(const QString& index, const QString& path)
@@ -628,17 +640,15 @@
 
 void UploadDialog::Private::_k_fileUploadFinished(Attica::BaseJob* )
 {
-    ui.mProgressLabel->setText(ui.mProgressLabel->text() + "\n\n" + i18n("Content \
file successfully uploaded.")); +    \
ui.uploadContentImageLabel->setPixmap(KIcon("dialog-ok").pixmap(16));  \
                finishedContents = true;
-
     uploadFileFinished();
 }
 
 void UploadDialog::Private::_k_previewUploadFinished(Attica::BaseJob* )
 {
-    ui.mProgressLabel->setText(ui.mProgressLabel->text() + "\n\n" + i18n("Preview \
image successfully uploaded.")); +    \
ui.uploadPreviewImageLabel->setPixmap(KIcon("dialog-ok").pixmap(16));  \
                finishedPreview = true;
-
     uploadFileFinished();
 }
 
@@ -653,4 +663,25 @@
     }
 }
 
+void UploadDialog::Private::fetchDownloadLink(const QString& contentId)
+{
+    kDebug() << "link for  " << contentId;
+    Attica::ItemJob<Attica::Content> *contentJob = \
currentProvider().requestContent(contentId); +    q->connect(contentJob, \
SIGNAL(finished(Attica::BaseJob*)), q, \
SLOT(_k_downloadLinkFetched(Attica::BaseJob*))); +    contentJob->start();
+}
+
+void UploadDialog::Private::_k_downloadLinkFetched(Attica::BaseJob* baseJob)
+{
+
+    Attica::ItemJob<Attica::Content>* contentItemJob = \
static_cast<Attica::ItemJob<Attica::Content>* >(baseJob); +    Attica::Content \
content = contentItemJob->result(); +
+    kDebug() << "link done " << content.detailpage().toString();
+
+    ui.contentWebsiteLink->setText(QLatin1String("<a href=\"") + \
content.detailpage().toString() + QLatin1String("\">") +                              \
+ i18nc("A link to the website where the get hot new stuff upload can be seen", \
"Visit website") + QLatin1String("</a>")); +    \
ui.fetchContentLinkImageLabel->setPixmap(KIcon("dialog-ok").pixmap(16)); +}
+
 #include "uploaddialog.moc"
--- trunk/KDE/kdelibs/knewstuff/knewstuff3/uploaddialog.h #1103667:1103668
@@ -152,10 +152,6 @@
 public Q_SLOTS:
     virtual void accept();
 
-private Q_SLOTS:
-
-
-
 private:
     bool init(const QString &configfile);
 
@@ -182,6 +178,7 @@
     Q_PRIVATE_SLOT( d, void _k_userContentListLoaded(Attica::BaseJob*) )
     Q_PRIVATE_SLOT( d, void _k_updatedContentFetched(Attica::BaseJob*) )
     Q_PRIVATE_SLOT( d, void _k_licensesFetched(Attica::BaseJob*) )
+    Q_PRIVATE_SLOT( d, void _k_downloadLinkFetched(Attica::BaseJob* baseJob) )
 
     Q_DISABLE_COPY( UploadDialog )
 };
--- trunk/KDE/kdelibs/knewstuff/knewstuff3/uploaddialog.ui #1103667:1103668
@@ -53,7 +53,7 @@
    <item>
     <widget class="QStackedWidget" name="stackedWidget">
      <property name="currentIndex">
-      <number>1</number>
+      <number>4</number>
      </property>
      <widget class="QWidget" name="page_3">
       <layout class="QGridLayout" name="gridLayout_3">
@@ -466,48 +466,163 @@
       </layout>
      </widget>
      <widget class="QWidget" name="page_2">
-      <layout class="QGridLayout" name="gridLayout_5">
-       <item row="1" column="0" colspan="2">
-        <widget class="QLabel" name="mProgressLabel">
-         <property name="text">
-          <string/>
-         </property>
-        </widget>
+      <layout class="QVBoxLayout" name="verticalLayout_3">
+       <item>
+        <layout class="QGridLayout" name="gridLayout_4">
+         <item row="0" column="0">
+          <widget class="QLabel" name="createContentImageLabel">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+             <horstretch>22</horstretch>
+             <verstretch>22</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="minimumSize">
+            <size>
+             <width>22</width>
+             <height>22</height>
+            </size>
+           </property>
+           <property name="text">
+            <string/>
+           </property>
+          </widget>
+         </item>
+         <item row="1" column="0">
+          <widget class="QLabel" name="uploadContentImageLabel">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+             <horstretch>22</horstretch>
+             <verstretch>22</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="minimumSize">
+            <size>
+             <width>22</width>
+             <height>22</height>
+            </size>
+           </property>
+           <property name="text">
+            <string/>
+           </property>
+          </widget>
+         </item>
+         <item row="2" column="0">
+          <widget class="QLabel" name="uploadPreviewImageLabel">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+             <horstretch>22</horstretch>
+             <verstretch>22</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="minimumSize">
+            <size>
+             <width>22</width>
+             <height>22</height>
+            </size>
+           </property>
+           <property name="text">
+            <string/>
+           </property>
+          </widget>
+         </item>
+         <item row="3" column="0">
+          <widget class="QLabel" name="fetchContentLinkImageLabel">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+             <horstretch>22</horstretch>
+             <verstretch>22</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="minimumSize">
+            <size>
+             <width>22</width>
+             <height>22</height>
+            </size>
+           </property>
+           <property name="maximumSize">
+            <size>
+             <width>22</width>
+             <height>16777215</height>
+            </size>
+           </property>
+           <property name="text">
+            <string/>
+           </property>
+          </widget>
+         </item>
+         <item row="3" column="1">
+          <widget class="QLabel" name="contentWebsiteLinkLabel">
+           <property name="text">
+            <string>Fetch content link from server</string>
+           </property>
+          </widget>
+         </item>
+         <item row="0" column="1">
+          <widget class="QLabel" name="creatingContentLabel">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="text">
+            <string>Create content on server</string>
+           </property>
+          </widget>
+         </item>
+         <item row="1" column="1">
+          <widget class="QLabel" name="creatingContentLabel_2">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="text">
+            <string>Upload content</string>
+           </property>
+          </widget>
+         </item>
+         <item row="2" column="1">
+          <widget class="QLabel" name="uploadPreviewLabel">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="text">
+            <string>Upload preview</string>
+           </property>
+          </widget>
+         </item>
+         <item row="4" column="1">
+          <widget class="QLabel" name="contentWebsiteLink">
+           <property name="text">
+            <string/>
+           </property>
+           <property name="openExternalLinks">
+            <bool>true</bool>
+           </property>
+          </widget>
+         </item>
+         <item row="5" column="1">
+          <spacer name="verticalSpacer">
+           <property name="orientation">
+            <enum>Qt::Vertical</enum>
+           </property>
+           <property name="sizeHint" stdset="0">
+            <size>
+             <width>91</width>
+             <height>199</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+        </layout>
        </item>
-       <item row="4" column="0">
-        <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 row="2" column="1">
-        <spacer name="verticalSpacer">
-         <property name="orientation">
-          <enum>Qt::Vertical</enum>
-         </property>
-         <property name="sizeHint" stdset="0">
-          <size>
-           <width>91</width>
-           <height>199</height>
-          </size>
-         </property>
-        </spacer>
-       </item>
-       <item row="4" column="1">
-        <widget class="QPushButton" name="uploadButton">
-         <property name="text">
-          <string>Start Upload</string>
-         </property>
-        </widget>
-       </item>
-       <item row="3" column="0" colspan="2">
+       <item>
         <widget class="QProgressBar" name="uploadProgressBar">
          <property name="maximum">
           <number>1</number>
@@ -517,6 +632,30 @@
          </property>
         </widget>
        </item>
+       <item>
+        <layout class="QHBoxLayout" name="horizontalLayout_2">
+         <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="uploadButton">
+           <property name="text">
+            <string>Start Upload</string>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
       </layout>
      </widget>
     </widget>
--- trunk/KDE/kdelibs/knewstuff/knewstuff3/uploaddialog_p.h #1103667:1103668
@@ -119,6 +119,9 @@
 
         void setBusy(const QString& message);
         void setIdle(const QString& message);
+
+        void fetchDownloadLink(const QString& contentId);
+        void _k_downloadLinkFetched(Attica::BaseJob* baseJob);
     };
 }
 


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

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