bool UpdatePlugin::done(unsigned, Buffer&, const char *headers) { string h = getHeader("Location", headers); if (h.empty()){ time_t now; time(&now); setTime(now); Event e(EventSaveState); e.process(); }else{ QWidget *main = getMainWindow(); if (main == NULL) return NULL; Command cmd; cmd->id = CmdStatusBar; Event eWidget(EventCommandWidget, cmd); QWidget *statusWidget = (QWidget*)(eWidget.process()); if (statusWidget == NULL) return NULL; m_url = h; QStringList l; l.append(i18n("Show details")); l.append(i18n("Remind later")); raiseWindow(main); m_msg = new BalloonMsg(NULL, i18n("New version SIM is released"), l, statusWidget); connect(m_msg, SIGNAL(action(int, void*)), this, SLOT(showDetails(int, void*))); connect(m_msg, SIGNAL(finished()), this, SLOT(msgDestroyed())); m_msg->show(); } return false; }
void *UpdatePlugin::processEvent(Event *e) { if (e->type() == EventFetchDone){ fetchData *data = (fetchData*)(e->param()); if (data->req_id != m_fetch_id) return NULL; string h = getHeader("Location", data->headers); if (h.empty()){ time_t now; time(&now); setTime(now); Event e(EventSaveState); e.process(); }else{ QWidget *main = getMainWindow(); if (main == NULL) return NULL; Command cmd; cmd->id = CmdStatusBar; Event eWidget(EventCommandWidget, cmd); QWidget *statusWidget = (QWidget*)(eWidget.process()); if (statusWidget == NULL) return NULL; m_url = h; QStringList l; l.append(i18n("Show details")); l.append(i18n("Remind later")); raiseWindow(main); BalloonMsg *msg = new BalloonMsg(NULL, i18n("New version SIM is released"), l, statusWidget); connect(msg, SIGNAL(action(int, void*)), this, SLOT(showDetails(int, void*))); connect(msg, SIGNAL(destroyed()), this, SLOT(msgDestroyed())); msg->show(); return NULL; } m_fetch_id = 0; }