33 #include <QtGui/QLayout> 
   34 #include <QtXml/qdom.h> 
   35 #include <QtGui/QToolButton> 
   63     m_p = 
new KMenu(
this);
 
   64     action_install = m_p->addAction(
SmallIcon(
"get-hot-new-stuff"),
 
   66     action_uninstall = m_p->addAction(
i18n(
"Uninstall"));
 
   67     action_comments = m_p->addAction(
SmallIcon(
"help-about"),
 
   69     action_changes = m_p->addAction(
SmallIcon(
"help-about"),
 
   72     m_history = 
new KMenu(
this);
 
   73     m_history->setTitle(
i18n(
"Switch version"));
 
   79     action_historysub = m_p->addMenu(m_history);
 
   82     action_info = m_p->addAction(
i18n(
"Provider information"));
 
   84     m_contact = 
new KMenu(
this);
 
   85     m_contact->setIcon(
SmallIcon(
"mail-message-new"));
 
   86     m_contact->setTitle(
i18n(
"Contact author"));
 
   89     pcollab->setTitle(
i18n(
"Collaboration"));
 
   91     action_collabrating = pcollab->addAction(
i18n(
"Add Rating"));
 
   92     action_collabcomment = pcollab->addAction(
i18n(
"Add Comment"));
 
   93     action_collabtranslation = pcollab->addAction(
i18n(
"Translate"));
 
   94     action_collabsubscribe = pcollab->addAction(
i18n(
"Subscribe"));
 
   95     action_collabremoval = pcollab->addAction(
i18n(
"Report bad entry"));
 
   96     pcollab->addMenu(m_contact);
 
   99     action_collaboratesub = m_p->addMenu(pcollab);
 
  101     connect(
this, SIGNAL(clicked()), SLOT(
slotClicked()));
 
  112     setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
 
  113     setPopupMode(QToolButton::MenuButtonPopup);
 
  128     if (m_engine) setEnabled(
true);
 
  133         setText(
i18n(
"Uninstall"));
 
  134         action_install->setVisible(
false);
 
  135         action_uninstall->setVisible(
true);
 
  138         setText(
i18n(
"Update"));
 
  139         action_uninstall->setVisible(
false);
 
  140         action_install->setVisible(
true);
 
  144         setText(
i18n(
"Install"));
 
  145         action_uninstall->setVisible(
false);
 
  146         action_install->setVisible(
true);
 
  149         setText(
i18n(
"Install"));
 
  150         action_uninstall->setVisible(
false);
 
  151         action_install->setVisible(
true);
 
  155     if (!author.
email().isEmpty()) {
 
  156         m_contact->setEnabled(
true);
 
  157         action_contactbymail = m_contact->addAction(
SmallIcon(
"mail-message-new"),
 
  160         m_contact->setEnabled(
false);
 
  161     if (!author.
jabber().isEmpty()) {
 
  162         action_contactbyjabber = m_contact->addAction(
i18n(
"Contact on Jabber"));
 
  168     m_provider = provider;
 
  170     if (!provider) 
return;
 
  176         action_collabrating->setEnabled(
true);
 
  177         action_collabcomment->setEnabled(
true);
 
  178         action_collabtranslation->setEnabled(
true);
 
  179         action_collabsubscribe->setEnabled(
true);
 
  180         action_collabremoval->setEnabled(
true);
 
  182         action_comments->setEnabled(
true);
 
  183         action_changes->setEnabled(
true);
 
  185         m_history->setEnabled(
true);
 
  187         action_collabrating->setEnabled(
false);
 
  188         action_collabcomment->setEnabled(
false);
 
  189         action_collabtranslation->setEnabled(
false);
 
  190         action_collabsubscribe->setEnabled(
false);
 
  191         action_collabremoval->setEnabled(
false);
 
  193         action_comments->setEnabled(
false);
 
  194         action_changes->setEnabled(
false);
 
  196         m_history->setEnabled(
false);
 
  204     if (m_entry) setEnabled(
true);
 
  206     m_dxs = 
new KNS::Dxs(m_engine, NULL);
 
  207     m_dxs->
setEndpoint(
KUrl(
"http://new.kstuff.org/cgi-bin/hotstuff-dxs"));
 
  231             SIGNAL(signalRemoval(
bool)),
 
  234             SIGNAL(signalSubscription(
bool)),
 
  237             SIGNAL(signalComment(
bool)),
 
  240             SIGNAL(signalRating(
bool)),
 
  243             SIGNAL(signalFault()),
 
  246             SIGNAL(signalError()),
 
  253     infostring += 
'\n' + 
i18n(
"Provider: %1", provider);
 
  254     infostring += 
'\n' + 
i18n(
"Version: %1", version);
 
  258                              i18n(
"Provider information"));
 
  271     for (KNS::Entry::List::Iterator it = entries.begin(); it != entries.end(); ++it) {
 
  281     for (QStringList::const_iterator it = comments.begin(); it != comments.end(); ++it) {
 
  293     for (QStringList::const_iterator it = changes.begin(); it != changes.end(); ++it) {
 
  306     for (QStringList::const_iterator it = entries.begin(); it != entries.end(); ++it) {
 
  315     if (entries.size() == 0) {
 
  321     m_history->setCursor(Qt::ArrowCursor);
 
  328                                  i18n(
"The removal request was successfully registered."),
 
  329                                  i18n(
"Removal of entry"));
 
  332                            i18n(
"The removal request failed."),
 
  333                            i18n(
"Removal of entry"));
 
  341                                  i18n(
"The subscription was successfully completed."),
 
  342                                  i18n(
"Subscription to entry"));
 
  345                            i18n(
"The subscription request failed."),
 
  346                            i18n(
"Subscription to entry"));
 
  354                                  i18n(
"The rating was submitted successfully."),
 
  355                                  i18n(
"Rating for entry"));
 
  358                            i18n(
"The rating could not be submitted."),
 
  359                            i18n(
"Rating for entry"));
 
  367                                  i18n(
"The comment was submitted successfully."),
 
  368                                  i18n(
"Comment on entry"));
 
  371                            i18n(
"The comment could not be submitted."),
 
  372                            i18n(
"Comment on entry"));
 
  379                        i18n(
"A protocol fault has occurred. The request has failed."),
 
  380                        i18n(
"Desktop Exchange Service"));
 
  386                        i18n(
"A network error has occurred. The request has failed."),
 
  387                        i18n(
"Desktop Exchange Service"));
 
  392     int version = 
id - historyslots;
 
  402     if (action == action_info) {
 
  412     if (action == action_comments) {
 
  415     if (action == action_changes) {
 
  418     if (action == action_contactbymail) {
 
  422     if (action == action_contactbyjabber) {
 
  425     if (action == action_collabtranslation) {
 
  429         ret = translation.exec();
 
  430         if (ret == QDialog::Accepted) {
 
  438     if (action == action_collabremoval) {
 
  442     if (action == action_collabsubscribe) {
 
  446     if (action == action_uninstall) {
 
  448             setText(
i18n(
"Install"));
 
  449             action_uninstall->setVisible(
false);
 
  450             action_install->setVisible(
true);
 
  453     if (action == action_install) {
 
  455                 SIGNAL(signalPayloadLoaded(
KUrl)),
 
  463     if (action == action_collabcomment) {
 
  467         ret = comment.exec();
 
  468         if (ret == QDialog::Accepted) {
 
  475     if (action == action_collabrating) {
 
  480         if (ret == QDialog::Accepted) {
 
  493     if (
id == historyinactive) {
 
  495         m_history->setCursor(
QCursor(Qt::WaitCursor));
 
  505     if (action_install->isVisible())
 
  511 bool KDXSButton::authenticate()
 
  513     if ((!m_username.isEmpty()) && (!m_password.isEmpty())) 
return true;
 
  516     dlg.setPrompt(
i18n(
"This operation requires authentication."));
 
  517     int ret = dlg.exec();
 
  518     if (ret == QDialog::Accepted) {
 
  519         m_username = dlg.username();
 
  520         m_password = dlg.password();
 
  534         setText(
i18n(
"Uninstall"));
 
  535         action_install->setVisible(
false);
 
  536         action_uninstall->setVisible(
true);
 
  538         setText(
i18n(
"Install"));
 
  539         action_uninstall->setVisible(
false);
 
  540         action_install->setVisible(
true);
 
  551 #include "kdxsbutton.moc" 
QString jabber() const 
Retrieve the author's jabber address. 
KNewStuff changelog window. 
QString i18n(const char *text)
void call_comments(int id)
void call_rating(int id, int rating)
Change the rating. 
void call_changes(int id)
KTranslatable name() const 
Retrieves the common name of the provider. 
void addChangelog(const QString &version, const QString &log)
void call_comment(int id, QString comment)
KNewStuff data entry container. 
static void information(QWidget *parent, const QString &text, const QString &caption=QString(), const QString &dontShowAgainName=QString(), Options options=Notify)
Status status()
Retrieves the entry's status. 
QString email() const 
Retrieve the author's email address. 
Status
Status of the entry. 
KNewStuff rating submission window. 
Author author() const 
Retrieve the author of the object. 
KNewStuff author information. 
QString pathOrUrl() const 
void call_subscription(int id, bool subscribe)
bool uninstall(KNS::Entry *entry)
Uninstalls an entry. 
QString representation() const 
Returns the string which matches most closely the current language. 
void call_history(int id)
void call_removal(int id)
bool install(const QString &payloadfile)
Installs an entry's payload file. 
QPixmap SmallIcon(const QString &name, int force_size, int state, const QStringList &overlays)
KNewStuff translation submission window. 
KUrl webService() const 
Retrieves the URL to the DXS Web Service. 
void setEndpoint(KUrl endpoint)
KNewStuff provider container. 
static void error(QWidget *parent, const QString &text, const QString &caption=QString(), Options options=Notify)
void downloadPayload(Entry *entry)
Downloads a payload file.