Ticket #32: UNCOMMITTED-LikeBack.2.patch

File UNCOMMITTED-LikeBack.2.patch, 68.9 kB (added by valerio, 3 months ago)

Fully ported version.

  • src/kmess.cpp

     
    4141#include "utils/kmessshared.h" 
    4242#include "utils/nowlisteningclient.h" 
    4343#include "utils/richtextparser.h" 
     44#include "utils/likeback/likeback.h" 
    4445#include "account.h" 
    4546#include "accountsmanager.h" 
    4647#include "accountaction.h" 
     
    12341235  // Setting up DBus 
    12351236  dbus_ = new KMessDBus( this ); 
    12361237 
     1238  LikeBack *likeBack = new LikeBack( LikeBack::AllButtons, true ); 
     1239  likeBack->setServer( "www.kmess.org", "/likeback/send.php", 80 ); 
     1240  likeBack->setWindowNamesListing( LikeBack::AllWindows ); 
     1241 
     1242  QStringList acceptedLocales; 
     1243  acceptedLocales << "en" << "nl" << "it" << "fr" << "de"; 
     1244  likeBack->setAcceptedLanguages( acceptedLocales ); 
     1245 
    12371246  // All done, mark as initialized 
    12381247#ifdef KMESSDEBUG_KMESS 
    12391248  kDebug() << "main class is initialized."; 
  • src/CMakeLists.txt

     
    103103   utils/thumbnailprovider.cpp 
    104104   utils/xautolock.cpp 
    105105   utils/xmlfunctions.cpp 
     106   utils/likeback/likeback.cpp 
     107   utils/likeback/likebackbar.cpp 
     108   utils/likeback/likebackdialog.cpp 
    106109   account.cpp 
    107110   accountaction.cpp 
    108111   accountsmanager.cpp 
     
    146149   settings/chatstylepage.ui 
    147150   settings/emoticonspage.ui 
    148151   settings/miscellaneouspage.ui 
     152   utils/likeback/likebackbar.ui 
     153   utils/likeback/likebackdialog.ui 
    149154) 
    150155 
    151156SET(kmess_LIBS 
  • src/kmessdebug.h

     
    3030  #define KMESS_NETWORK_WINDOW 
    3131 
    3232  #define KMESSDEBUG_KMESS 
     33  #define KMESSDEBUG_LIKEBACK 
    3334  #define KMESSDEBUG_KMESSAPPLICATION 
    3435  #define KMESSDEBUG_KMESSINTERFACE 
    3536  #define KMESSDEBUG_KMESSVIEW 
  • src/utils/likeback/likebackbar.h

     
     1 
     2 
     3#ifndef LIKEBACKBAR_H 
     4#define LIKEBACKBAR_H 
     5 
     6#include <QTimer> 
     7#include <QWidget> 
     8 
     9#include "likeback.h" 
     10 
     11#include "ui_likebackbar.h" 
     12 
     13 
     14 
     15class LikeBackBar : public QWidget, private Ui::LikeBackBar 
     16{ 
     17  Q_OBJECT 
     18 
     19  public: 
     20    // Constructor 
     21             LikeBackBar( LikeBack *likeBack ); 
     22    // Destructor 
     23            ~LikeBackBar(); 
     24 
     25  public slots: 
     26    // Begin moving the bar 
     27    void     startTimer(); 
     28    // End moving the bar 
     29    void     stopTimer(); 
     30 
     31  private slots: 
     32    // Move the bar where the parent window is 
     33    void     autoMove(); 
     34    // The Like button has been clicked 
     35    void     likeClicked(); 
     36    // The Dislike button has been clicked 
     37    void     dislikeClicked(); 
     38    // The Bug button has been clicked 
     39    void     bugClicked(); 
     40    // The Feature button has been clicked 
     41    void     featureClicked(); 
     42 
     43  private: 
     44    // The parent LikeBack instance 
     45    LikeBack *m_likeBack; 
     46    // Timer to adjust the bar position 
     47    QTimer    m_timer; 
     48 
     49}; 
     50 
     51#endif 
  • src/utils/likeback/likebackdialog.ui

     
     1<ui version="4.0" > 
     2 <class>LikeBackDialog</class> 
     3 <widget class="QWidget" name="LikeBackDialog" > 
     4  <property name="geometry" > 
     5   <rect> 
     6    <x>0</x> 
     7    <y>0</y> 
     8    <width>358</width> 
     9    <height>366</height> 
     10   </rect> 
     11  </property> 
     12  <property name="windowTitle" > 
     13   <string/> 
     14  </property> 
     15  <layout class="QVBoxLayout" name="verticalLayout_2" > 
     16   <item> 
     17    <widget class="QLabel" name="m_informationLabel" > 
     18     <property name="sizePolicy" > 
     19      <sizepolicy vsizetype="Fixed" hsizetype="Expanding" > 
     20       <horstretch>0</horstretch> 
     21       <verstretch>0</verstretch> 
     22      </sizepolicy> 
     23     </property> 
     24     <property name="text" > 
     25      <string/> 
     26     </property> 
     27     <property name="scaledContents" > 
     28      <bool>true</bool> 
     29     </property> 
     30     <property name="alignment" > 
     31      <set>Qt::AlignJustify|Qt::AlignTop</set> 
     32     </property> 
     33     <property name="wordWrap" > 
     34      <bool>true</bool> 
     35     </property> 
     36    </widget> 
     37   </item> 
     38   <item> 
     39    <widget class="QLabel" name="label_2" > 
     40     <property name="sizePolicy" > 
     41      <sizepolicy vsizetype="Fixed" hsizetype="Preferred" > 
     42       <horstretch>0</horstretch> 
     43       <verstretch>0</verstretch> 
     44      </sizepolicy> 
     45     </property> 
     46     <property name="text" > 
     47      <string>Your comment:</string> 
     48     </property> 
     49    </widget> 
     50   </item> 
     51   <item> 
     52    <widget class="QPlainTextEdit" name="m_comment" > 
     53     <property name="minimumSize" > 
     54      <size> 
     55       <width>350</width> 
     56       <height>64</height> 
     57      </size> 
     58     </property> 
     59    </widget> 
     60   </item> 
     61   <item> 
     62    <widget class="QGroupBox" name="groupBox" > 
     63     <property name="sizePolicy" > 
     64      <sizepolicy vsizetype="Fixed" hsizetype="Expanding" > 
     65       <horstretch>0</horstretch> 
     66       <verstretch>0</verstretch> 
     67      </sizepolicy> 
     68     </property> 
     69     <property name="title" > 
     70      <string>Your comment is about:</string> 
     71     </property> 
     72     <layout class="QVBoxLayout" name="verticalLayout" > 
     73      <item> 
     74       <widget class="QRadioButton" name="likeRadio_" > 
     75        <property name="sizePolicy" > 
     76         <sizepolicy vsizetype="Fixed" hsizetype="Minimum" > 
     77          <horstretch>0</horstretch> 
     78          <verstretch>0</verstretch> 
     79         </sizepolicy> 
     80        </property> 
     81        <property name="text" > 
     82         <string>Something you like</string> 
     83        </property> 
     84       </widget> 
     85      </item> 
     86      <item> 
     87       <widget class="QRadioButton" name="dislikeRadio_" > 
     88        <property name="sizePolicy" > 
     89         <sizepolicy vsizetype="Fixed" hsizetype="Minimum" > 
     90          <horstretch>0</horstretch> 
     91          <verstretch>0</verstretch> 
     92         </sizepolicy> 
     93        </property> 
     94        <property name="text" > 
     95         <string>Something you dislike</string> 
     96        </property> 
     97       </widget> 
     98      </item> 
     99      <item> 
     100       <widget class="QRadioButton" name="bugRadio_" > 
     101        <property name="sizePolicy" > 
     102         <sizepolicy vsizetype="Fixed" hsizetype="Minimum" > 
     103          <horstretch>0</horstretch> 
     104          <verstretch>0</verstretch> 
     105         </sizepolicy> 
     106        </property> 
     107        <property name="text" > 
     108         <string>An improper behavior of the application</string> 
     109        </property> 
     110       </widget> 
     111      </item> 
     112      <item> 
     113       <widget class="QRadioButton" name="featureRadio_" > 
     114        <property name="sizePolicy" > 
     115         <sizepolicy vsizetype="Fixed" hsizetype="Minimum" > 
     116          <horstretch>0</horstretch> 
     117          <verstretch>0</verstretch> 
     118         </sizepolicy> 
     119        </property> 
     120        <property name="text" > 
     121         <string>A new feature you desire</string> 
     122        </property> 
     123       </widget> 
     124      </item> 
     125     </layout> 
     126    </widget> 
     127   </item> 
     128   <item> 
     129    <widget class="QCheckBox" name="specifyEmailCheckBox_" > 
     130     <property name="sizePolicy" > 
     131      <sizepolicy vsizetype="Fixed" hsizetype="Expanding" > 
     132       <horstretch>0</horstretch> 
     133       <verstretch>0</verstretch> 
     134      </sizepolicy> 
     135     </property> 
     136     <property name="text" > 
     137      <string>Specify an e-mail address to be contacted back</string> 
     138     </property> 
     139    </widget> 
     140   </item> 
     141   <item> 
     142    <layout class="QHBoxLayout" name="horizontalLayout" > 
     143     <item> 
     144      <spacer name="horizontalSpacer_2" > 
     145       <property name="orientation" > 
     146        <enum>Qt::Horizontal</enum> 
     147       </property> 
     148       <property name="sizeType" > 
     149        <enum>QSizePolicy::Fixed</enum> 
     150       </property> 
     151       <property name="sizeHint" stdset="0" > 
     152        <size> 
     153         <width>20</width> 
     154         <height>20</height> 
     155        </size> 
     156       </property> 
     157      </spacer> 
     158     </item> 
     159     <item> 
     160      <widget class="QLineEdit" name="emailAddressEdit_" > 
     161       <property name="enabled" > 
     162        <bool>false</bool> 
     163       </property> 
     164       <property name="sizePolicy" > 
     165        <sizepolicy vsizetype="Fixed" hsizetype="Expanding" > 
     166         <horstretch>0</horstretch> 
     167         <verstretch>0</verstretch> 
     168        </sizepolicy> 
     169       </property> 
     170      </widget> 
     171     </item> 
     172    </layout> 
     173   </item> 
     174   <item> 
     175    <widget class="QCheckBox" name="showBarCheckbox_" > 
     176     <property name="text" > 
     177      <string>Show the feedback buttons bar on the windows</string> 
     178     </property> 
     179    </widget> 
     180   </item> 
     181  </layout> 
     182 </widget> 
     183 <resources/> 
     184 <connections> 
     185  <connection> 
     186   <sender>specifyEmailCheckBox_</sender> 
     187   <signal>toggled(bool)</signal> 
     188   <receiver>emailAddressEdit_</receiver> 
     189   <slot>setEnabled(bool)</slot> 
     190   <hints> 
     191    <hint type="sourcelabel" > 
     192     <x>84</x> 
     193     <y>298</y> 
     194    </hint> 
     195    <hint type="destinationlabel" > 
     196     <x>156</x> 
     197     <y>333</y> 
     198    </hint> 
     199   </hints> 
     200  </connection> 
     201 </connections> 
     202</ui> 
  • src/utils/likeback/likebackdialog.cpp

     
     1 
     2#include <QHttp> 
     3#include <QHttpRequestHeader> 
     4 
     5#include <KAboutData> 
     6#include <KApplication> 
     7#include <KDebug> 
     8#include <KMessageBox> 
     9#include <KPushButton> 
     10 
     11#include "likebackdialog.h" 
     12#include "../kmessconfig.h" 
     13#include "../../account.h" 
     14#include "../../kmessdebug.h" 
     15 
     16 
     17 
     18// Constructor 
     19LikeBackDialog::LikeBackDialog( LikeBack::Button reason, const QString &initialComment, 
     20                                const QString &windowPath, const QString &context, LikeBack *likeBack ) 
     21: KDialog( kapp->activeWindow() ) 
     22, Ui::LikeBackDialog() 
     23, m_context( context ) 
     24, m_likeBack( likeBack ) 
     25, m_windowPath( windowPath ) 
     26{ 
     27  // KDialog Options 
     28  setCaption( i18n( "Send a Comment to the Developers" ) ); 
     29  setButtons( Ok | Cancel ); 
     30  setDefaultButton( Ok ); 
     31  setObjectName( "_likeback_feedback_window_" ); 
     32  showButtonSeparator( true ); 
     33  restoreDialogSize( KMessConfig::instance()->getGlobalConfig( "LikeBackDialog" ) ); 
     34 
     35  // Set up the user interface 
     36  QWidget *mainWidget = new QWidget( this ); 
     37  setupUi( mainWidget ); 
     38  setMainWidget( mainWidget ); 
     39 
     40  // Group the buttons together to retrieve the checked one quickly 
     41  m_typeGroup_ = new QButtonGroup( this ); 
     42  m_typeGroup_->addButton( likeRadio_,    LikeBack::Like    ); 
     43  m_typeGroup_->addButton( dislikeRadio_, LikeBack::Dislike ); 
     44  m_typeGroup_->addButton( bugRadio_,     LikeBack::Bug     ); 
     45  m_typeGroup_->addButton( featureRadio_, LikeBack::Feature ); 
     46 
     47  // Hide unneeded buttons 
     48  LikeBack::Button buttons = m_likeBack->buttons(); 
     49  likeRadio_   ->setVisible( buttons & LikeBack::Like    ); 
     50  dislikeRadio_->setVisible( buttons & LikeBack::Dislike ); 
     51  bugRadio_    ->setVisible( buttons & LikeBack::Bug     ); 
     52  featureRadio_->setVisible( buttons & LikeBack::Feature ); 
     53 
     54  // If no specific "reason" is provided, choose the first one: 
     55  if( reason == LikeBack::AllButtons || reason == LikeBack::DefaultButtons ) 
     56  { 
     57         if( buttons & LikeBack::Dislike ) reason = LikeBack::Dislike; 
     58    else if( buttons & LikeBack::Bug     ) reason = LikeBack::Bug; 
     59    else if( buttons & LikeBack::Feature ) reason = LikeBack::Feature; 
     60    else                                   reason = LikeBack::Like; 
     61  } 
     62  // Choose which button to check 
     63  switch( reason ) 
     64  { 
     65    case LikeBack::Like:    likeRadio_   ->setChecked( true ); break; 
     66    case LikeBack::Dislike: dislikeRadio_->setChecked( true ); break; 
     67    case LikeBack::Bug:     bugRadio_    ->setChecked( true ); break; 
     68    case LikeBack::Feature: featureRadio_->setChecked( true ); break; 
     69    default: break; // Will never arrive here 
     70  } 
     71 
     72   // Disable the Ok button if no comment is present 
     73   connect( m_comment, SIGNAL( textChanged() ), 
     74            this,      SLOT  (      verify() ) ); 
     75 
     76  // If no window path is provided, get the current active window path: 
     77  if( m_windowPath.isEmpty() ) 
     78  { 
     79    m_windowPath = LikeBack::activeWindowPath(); 
     80  } 
     81 
     82  // Specify the initial comment 
     83  m_comment->setPlainText( initialComment ); 
     84  m_comment->setFocus(); 
     85 
     86  // Set the Show Bar checkbox status and connect it 
     87  showBarCheckbox_->setChecked( m_likeBack->userWantsToShowBar() ); 
     88  connect( showBarCheckbox_, SIGNAL(               toggled(bool) ), 
     89           m_likeBack,       SLOT  ( setUserWantsToShowBar(bool) ) ); 
     90 
     91  // Provide the initial status for email address widgets if available 
     92  emailAddressEdit_->setText( m_likeBack->emailAddress() ); 
     93  specifyEmailCheckBox_->setChecked( m_likeBack->emailAddressAlreadyProvided() ); 
     94 
     95  // The introduction message is long and will require a new minimum dialog size 
     96  m_informationLabel->setText( introductionText() ); 
     97  setMinimumSize( minimumSizeHint() ); 
     98 
     99  // Initially verify the widgets status 
     100  verify(); 
     101} 
     102 
     103 
     104 
     105// Destructor 
     106LikeBackDialog::~LikeBackDialog() 
     107{ 
     108  KConfigGroup group = KMessConfig::instance()->getGlobalConfig( "LikeBackDialog" ); 
     109  saveDialogSize( group ); 
     110} 
     111 
     112 
     113 
     114// Construct the introductory text of the dialog 
     115QString LikeBackDialog::introductionText() 
     116{ 
     117  QStringList acceptedLocales; 
     118  KLocale *kLocale = KGlobal::locale(); 
     119  QStringList acceptedLocaleCodes = m_likeBack->acceptedLocales(); 
     120 
     121  // Define a list of languages which the application developers are able to understand 
     122  if( ! acceptedLocaleCodes.isEmpty() ) 
     123  { 
     124    foreach( QString locale, acceptedLocaleCodes ) 
     125    { 
     126      acceptedLocales << kLocale->languageCodeToName( locale ); 
     127    } 
     128  } 
     129  else if( ! kLocale->language().startsWith( "en" ) ) 
     130  { 
     131    acceptedLocales << kLocale->languageCodeToName( "en" ); 
     132  } 
     133 
     134  // Put the locales list together in a readable string 
     135  QString languagesMessage; 
     136  if( ! acceptedLocales.isEmpty() ) 
     137  { 
     138    // TODO: Replace the URL with a localized one: 
     139    QString translationTool( "http://www.google.com/language_tools?hl=" + kLocale->language() ); 
     140 
     141    if( acceptedLocales.count() == 1 ) 
     142    { 
     143      languagesMessage = i18nc( "Feedback dialog text, message with one accepted language for the comments", 
     144                                "Please, write it in %1 (you may want to use an <a href=\"%3\">online translation tool</a> for this).<br/>", 
     145                                acceptedLocales.first(), 
     146                                translationTool ); 
     147    } 
     148    else 
     149    { 
     150      languagesMessage = i18nc( "Feedback dialog text, message with list of accepted languages for the comments", 
     151                                "Please, write it in %1 or %2 (you may want to use an <a href=\"%3\">online translation tool</a> for this).<br/>", 
     152                                QStringList( acceptedLocales.mid( 1 ) ).join( ", " ), 
     153                                acceptedLocales.first(), 
     154                                translationTool ); 
     155    } 
     156  } 
     157 
     158  // If both "I Like" and "I Dislike" buttons are shown and one is clicked: 
     159  QString balancingMessage; 
     160  if( m_likeBack->isLikeActive() && m_likeBack->isDislikeActive() 
     161  && ( m_typeGroup_->checkedId() == LikeBack::Like || m_typeGroup_->checkedId() == LikeBack::Dislike ) ) 
     162  { 
     163    balancingMessage = i18nc( "Feedback dialog text, message to remind to balance the likes and dislikes", 
     164                              "To make the comments you send more useful in improving this application, " 
     165                              "try to send the same amount of positive and negative comments.<br/>" ); 
     166  } 
     167 
     168  // If feature requests are not allowed: 
     169  QString noFeatureRequestsMessage; 
     170  if( ! m_likeBack->isFeatureActive() ) 
     171  { 
     172    noFeatureRequestsMessage = i18nc( "Feedback dialog text, text to disallow feature requests", 
     173                                      "Please, do not ask for new features: this kind of request will be ignored.<br/>" ); 
     174  } 
     175 
     176  // Blend all previous messages together 
     177  return i18nc( "Feedback dialog text, %1=Application name,%2=message with list of accepted languages for the comment," 
     178                "%3=optional text to remind to balance the likes and dislikes,%4=optional text to disallow feature requests.", 
     179                "<p>You can provide to the developers a brief description of your opinions of %1.<br/>" 
     180                "%2 " // %2: Contains the newline if present 
     181                "%3%4</p>", 
     182                m_likeBack->aboutData()->programName(), 
     183                languagesMessage, 
     184                balancingMessage, 
     185                noFeatureRequestsMessage ); 
     186} 
     187 
     188 
     189 
     190// Check if the UI should allow the user to send the comment 
     191void LikeBackDialog::verify() 
     192{ 
     193  bool hasComment = ( ! m_comment->document()->isEmpty() ); 
     194  bool hasType    = ( m_typeGroup_->checkedId() != -1 ); 
     195 
     196  button( Ok )->setEnabled( hasComment && hasType ); 
     197} 
     198 
     199 
     200 
     201// Send the comment to the developers site (reimplemented from KDialog) 
     202void LikeBackDialog::slotButtonClicked( int buttonId ) 
     203{ 
     204  // If the user has not pressed Ok, do nothing 
     205  if( buttonId != Ok ) 
     206  { 
     207    KDialog::slotButtonClicked( buttonId ); 
     208    return; 
     209  } 
     210 
     211  QString type; 
     212  QString emailAddress; 
     213 
     214  // Only send the email if the user wants it to be sent 
     215  if( specifyEmailCheckBox_->isChecked() ) 
     216  { 
     217    emailAddress = emailAddressEdit_->text(); 
     218 
     219    if( ! Account::isValidEmail( emailAddress ) ) 
     220    { 
     221      KMessageBox::error( this, i18n( "The email address you have entered is not valid, and cannot be used: '%1'", emailAddress ) ); 
     222      return; 
     223    } 
     224 
     225    m_likeBack->setEmailAddress( emailAddress, true ); 
     226  } 
     227 
     228  // Disable the UI while we're sending the request 
     229  m_comment->setEnabled( false ); 
     230  button( Ok )->setEnabled( false ); 
     231 
     232  // Choose the type of feedback 
     233  switch( m_typeGroup_->checkedId() ) 
     234  { 
     235    case LikeBack::Like:    type = "Like";    break; 
     236    case LikeBack::Dislike: type = "Dislike"; break; 
     237    case LikeBack::Bug:     type = "Bug";     break; 
     238    case LikeBack::Feature: type = "Feature"; break; 
     239  } 
     240 
     241  // Compile the feedback data 
     242  QString data = "protocol=" + QUrl::toPercentEncoding( "1.0" )                              + '&' + 
     243                 "type="     + QUrl::toPercentEncoding( type )                               + '&' + 
     244                 "version="  + QUrl::toPercentEncoding( m_likeBack->aboutData()->version() ) + '&' + 
     245                 "locale="   + QUrl::toPercentEncoding( KGlobal::locale()->language() )      + '&' + 
     246                 "window="   + QUrl::toPercentEncoding( m_windowPath )                       + '&' + 
     247                 "context="  + QUrl::toPercentEncoding( m_context )                          + '&' + 
     248                 "comment="  + QUrl::toPercentEncoding( m_comment->toPlainText() )           + '&' + 
     249                 "email="    + QUrl::toPercentEncoding( emailAddress ); 
     250 
     251 
     252#ifdef KMESSDEBUG_LIKEBACK 
     253  kDebug() << "http://" << m_likeBack->hostName() << ":" << m_likeBack->hostPort() << m_likeBack->remotePath(); 
     254  kDebug() << data; 
     255#endif 
     256 
     257  // Create the HTTP sending object and the actual request 
     258  QHttp *http = new QHttp( m_likeBack->hostName(), m_likeBack->hostPort() ); 
     259  connect( http, SIGNAL( requestFinished(int,bool) ), 
     260           this, SLOT  ( requestFinished(int,bool) ) ); 
     261 
     262  QHttpRequestHeader header( "POST", m_likeBack->remotePath() ); 
     263  header.setValue( "Host", m_likeBack->hostName() ); 
     264  header.setValue( "Content-Type", "application/x-www-form-urlencoded" ); 
     265 
     266  // Then send it at the developer site 
     267  http->setHost( m_likeBack->hostName() ); 
     268  m_requestNumber_ = http->request( header, data.toUtf8() ); 
     269} 
     270 
     271 
     272 
     273// Display confirmation of the sending action 
     274void LikeBackDialog::requestFinished( int id, bool error ) 
     275{ 
     276  // Only analyze the request we've sent 
     277  if( id != m_requestNumber_ ) 
     278  { 
     279#ifdef KMESSDEBUG_LIKEBACK 
     280  kDebug() << "Ignoring request" << id; 
     281#endif 
     282    return; 
     283  } 
     284 
     285#ifdef KMESSDEBUG_LIKEBACK 
     286  kDebug() << "Request has" << (error?"failed":"succeeded"); 
     287#endif 
     288 
     289  m_likeBack->disableBar(); 
     290 
     291  if( ! error ) 
     292  { 
     293    KMessageBox::information( this, 
     294                              i18nc( "Dialog box text", 
     295                                     "<p>Your comment has been sent successfully." 
     296                                     "It will help us improve the application!</p>" 
     297                                     "<p>Thanks for your time.</p>" ), 
     298                              i18nc( "Dialog box title", "Comment Sent" ) ); 
     299 
     300    hide(); 
     301    m_likeBack->enableBar(); 
     302    KDialog::accept(); 
     303    return; 
     304  } 
     305 
     306  // TODO: Save to file if error (connection not present at the moment) 
     307  KMessageBox::error( this, 
     308                      i18nc( "Dialog box text", 
     309                              "<p>There has been an error while trying to send the report.</p>" 
     310                              "<p>Please, try again later.</p>"), 
     311                      i18nc( "Dialog box title", "Comment Sending Error" ) ); 
     312 
     313  m_likeBack->enableBar(); 
     314 
     315  // Re-enable the UI 
     316  m_comment->setEnabled( true ); 
     317  verify(); 
     318} 
  • src/utils/likeback/likebackbar.ui

     
     1<ui version="4.0" > 
     2 <class>LikeBackBar</class> 
     3 <widget class="QWidget" name="LikeBackBar" > 
     4  <property name="geometry" > 
     5   <rect> 
     6    <x>0</x> 
     7    <y>0</y> 
     8    <width>96</width> 
     9    <height>24</height> 
     10   </rect> 
     11  </property> 
     12  <property name="sizePolicy" > 
     13   <sizepolicy vsizetype="Fixed" hsizetype="Fixed" > 
     14    <horstretch>0</horstretch> 
     15    <verstretch>0</verstretch> 
     16   </sizepolicy> 
     17  </property> 
     18  <property name="windowTitle" > 
     19   <string/> 
     20  </property> 
     21  <property name="autoFillBackground" > 
     22   <bool>true</bool> 
     23  </property> 
     24  <layout class="QHBoxLayout" name="horizontalLayout" > 
     25   <property name="spacing" > 
     26    <number>0</number> 
     27   </property> 
     28   <property name="margin" > 
     29    <number>0</number> 
     30   </property> 
     31   <item> 
     32    <widget class="QToolButton" name="m_likeButton" > 
     33     <property name="text" > 
     34      <string/> 
     35     </property> 
     36     <property name="autoRaise" > 
     37      <bool>true</bool> 
     38     </property> 
     39    </widget> 
     40   </item> 
     41   <item> 
     42    <widget class="QToolButton" name="m_dislikeButton" > 
     43     <property name="text" > 
     44      <string/> 
     45     </property> 
     46     <property name="autoRaise" > 
     47      <bool>true</bool> 
     48     </property> 
     49    </widget> 
     50   </item> 
     51   <item> 
     52    <widget class="QToolButton" name="m_bugButton" > 
     53     <property name="text" > 
     54      <string/> 
     55     </property> 
     56     <property name="autoRaise" > 
     57      <bool>true</bool> 
     58     </property> 
     59    </widget> 
     60   </item> 
     61   <item> 
     62    <widget class="QToolButton" name="m_featureButton" > 
     63     <property name="text" > 
     64      <string/> 
     65     </property> 
     66     <property name="autoRaise" > 
     67      <bool>true</bool> 
     68     </property> 
     69    </widget> 
     70   </item> 
     71  </layout> 
     72 </widget> 
     73 <resources/> 
     74 <connections> 
     75  <connection> 
     76   <sender>m_likeButton</sender> 
     77   <signal>clicked()</signal> 
     78   <receiver>LikeBackBar</receiver> 
     79   <slot>likeClicked()</slot> 
     80   <hints> 
     81    <hint type="sourcelabel" > 
     82     <x>23</x> 
     83     <y>23</y> 
     84    </hint> 
     85    <hint type="destinationlabel" > 
     86     <x>72</x> 
     87     <y>0</y> 
     88    </hint> 
     89   </hints> 
     90  </connection> 
     91  <connection> 
     92   <sender>m_dislikeButton</sender> 
     93   <signal>clicked()</signal> 
     94   <receiver>LikeBackBar</receiver> 
     95   <slot>dislikeClicked()</slot> 
     96   <hints> 
     97    <hint type="sourcelabel" > 
     98     <x>45</x> 
     99     <y>17</y> 
     100    </hint> 
     101    <hint type="destinationlabel" > 
     102     <x>95</x> 
     103     <y>0</y> 
     104    </hint> 
     105   </hints> 
     106  </connection> 
     107  <connection> 
     108   <sender>m_bugButton</sender> 
     109   <signal>clicked()</signal> 
     110   <receiver>LikeBackBar</receiver> 
     111   <slot>bugClicked()</slot> 
     112   <hints> 
     113    <hint type="sourcelabel" > 
     114     <x>67</x> 
     115     <y>20</y> 
     116    </hint> 
     117    <hint type="destinationlabel" > 
     118     <x>95</x> 
     119     <y>1</y> 
     120    </hint> 
     121   </hints> 
     122  </connection> 
     123  <connection> 
     124   <sender>m_featureButton</sender> 
     125   <signal>clicked()</signal> 
     126   <receiver>LikeBackBar</receiver> 
     127   <slot>featureClicked()</slot> 
     128   <hints> 
     129    <hint type="sourcelabel" > 
     130     <x>93</x> 
     131     <y>13</y> 
     132    </hint> 
     133    <hint type="destinationlabel" > 
     134     <x>95</x> 
     135     <y>13</y> 
     136    </hint> 
     137   </hints> 
     138  </connection> 
     139 </connections> 
     140 <slots> 
     141  <slot>likeClicked()</slot> 
     142  <slot>dislikeClicked()</slot> 
     143  <slot>bugClicked()</slot> 
     144  <slot>featureClicked()</slot> 
     145 </slots> 
     146</ui> 
  • src/utils/likeback/likeback.cpp

     
     1/*************************************************************************** 
     2 *   Copyright (C) 2006 by Sebastien Laout                                 * 
     3 *   slaout@linux62.org                                                    * 
     4 *                                                                         * 
     5 *   This program is free software; you can redistribute it and/or modify  * 
     6 *   it under the terms of the GNU Library General Public License as       *