void MeeGo::Sync::FrameworkClient::doPostInit(QString fuzzyTime, bool forceSync) { if (m_name.isEmpty()) { qCritical() << "ERROR: Empty profile name being used!"; emit profileRemoved(m_name); // Force return to main screen. return; } // Get the last sync result and update the status message to contain // the last time a sync occurred, or if it failed. If no sync // result exists a sync has never been run so perform an initial // sync. Buteo::SyncResults const results = m_sci.getLastSyncResult(m_name); if (results.majorCode() == Buteo::SyncResults::SYNC_RESULT_INVALID || forceSync) { doInitialSync(); // Never been "synced". } else { // Display the status of the last sync. if (results.majorCode() == Buteo::SyncResults::SYNC_RESULT_SUCCESS) { //: Arg 1 is a "fuzzy time", e.g. "2 min ago". setStatus(tr("Last sync %1").arg(fuzzyTime)); } else { // Last sync failed. Display how it failed. QString const e = syncResultToString(results); //: Arg 1 is a brief sync error description, e.g. "connection failed". setStatus(tr("Last sync failed: %1").arg(e)); // We could pop up the login dialog on authentication failure of // the last sync by emitting the authentication_failed() // signal. However, doing so could inadvertently make the user // re-enter shared credentials that were previously updated for // another account that uses those same credentials. For // example, the user could have updated the credentials for // Google Calendar because of an authentication failure. We // would not to immediately pop-up the login dialog if the last // sync for Google Contacts had an authentication failure. We'd // want to use the updated shared credentials. As such, we only // pop up the login dialog *immediately* after an authentication // failure. } // Flip the recurring sync toggle as necessary. QScopedPointer<Buteo::SyncProfile> profile(m_pm.syncProfile(m_name)); if (profile->syncType() == Buteo::SyncProfile::SYNC_SCHEDULED) setScheduled(true); } }
bool ProfileManager::removeProfile(Profile* profile) { profiles.removeOne(profile); if (getCurrentProfile() == profile) { if (profiles.size() == 0) { setCurrentProfile(NULL); } else { setCurrentProfile(profiles[0]); } } emit profileRemoved(profile); return true; }
void ColordEngine::init() { // Creates a ColorD interface, it must be created with new // otherwise the object will be deleted when this block ends QDBusInterface *interface; interface = new QDBusInterface(QLatin1String("org.freedesktop.ColorManager"), QLatin1String("/org/freedesktop/ColorManager"), QLatin1String("org.freedesktop.ColorManager"), QDBusConnection::systemBus(), this); // listen to colord for device events connect(interface, SIGNAL(DeviceAdded(QDBusObjectPath)), this, SLOT(deviceAdded(QDBusObjectPath))); connect(interface, SIGNAL(DeviceRemoved(QDBusObjectPath)), this, SLOT(deviceRemoved(QDBusObjectPath))); connect(interface, SIGNAL(DeviceChanged(QDBusObjectPath)), this, SLOT(deviceChanged(QDBusObjectPath))); // listen to colord for profile events connect(interface, SIGNAL(ProfileAdded(QDBusObjectPath)), this, SLOT(profileAdded(QDBusObjectPath))); connect(interface, SIGNAL(ProfileRemoved(QDBusObjectPath)), this, SLOT(profileRemoved(QDBusObjectPath))); connect(interface, SIGNAL(ProfileChanged(QDBusObjectPath)), this, SLOT(profileChanged(QDBusObjectPath))); // Ask for profiles QDBusMessage msg; msg = QDBusMessage::createMethodCall(QLatin1String("org.freedesktop.ColorManager"), QLatin1String("/org/freedesktop/ColorManager"), QLatin1String("org.freedesktop.ColorManager"), QLatin1String("GetProfiles")); QDBusConnection::systemBus().callWithCallback(msg, this, SLOT(gotProfiles(QDBusMessage))); // Ask for devices QDBusMessage message; message = QDBusMessage::createMethodCall(QLatin1String("org.freedesktop.ColorManager"), QLatin1String("/org/freedesktop/ColorManager"), QLatin1String("org.freedesktop.ColorManager"), QLatin1String("GetDevices")); QDBusConnection::systemBus().callWithCallback(message, this, SLOT(gotDevices(QDBusMessage))); }
void MeeGo::Sync::FrameworkClient::profileChanged(QString id, int type, QString /* profile_xml */) { // Used predominantly for debugging. switch(type) { case 0: // added qDebug() << "INFO: profile" << id << "added."; break; case 1: // modified // { qDebug() << "INFO: profile" << id << "modified."; // QDomDocument doc; // doc.setContent(profile_xml); // Buteo::SyncProfile profile(doc.documentElement()); // setScheduled(profile.syncType() == Buteo::SyncProfile::SYNC_SCHEDULED); // } break; case 2: // deleted qDebug() << "INFO: profile" << id << "removed."; if (--m_removalsPending == 0) { // All profiles with same SSO provider have been removed. emit profileRemoved(id); // Force return to main screen. } break; default: qWarning() << "WARNING: Unknown type (" << type << ") of profile change occured."; break; } }