MeeGo::Sync::FrameworkClient::FrameworkClient(QObject* parent)
  : QObject(parent)
  , m_sci()
  , m_pm()
  , m_processor()
  , m_cred()
  , m_scheduled(false)
  , m_status()
  , m_service()
  , m_storage()
  , m_name()
  , m_username()
  , m_password()
  , m_provider()
  , m_removalsPending(0)
{
  // --- Sync related events ---
  connect(&m_sci,
	  SIGNAL(syncStatus(QString,int,QString,int)),
	  this,
	  SLOT(syncStatus(QString,int,QString,int)));

  connect(&m_sci,
	  SIGNAL(resultsAvailable(QString,Buteo::SyncResults)),
	  this,
	  SLOT(resultsAvailable(QString,Buteo::SyncResults)));

  connect(&m_sci,
	  SIGNAL(profileChanged(QString,int,QString)),
	  this,
	  SLOT(profileChanged(QString,int,QString)));
}
Пример #2
0
void ProcessMonitor::processFinished()
{
   Process* process(qobject_cast<Process*>(sender()));
   if (!process) {
      qDebug() << "Process cast failed in ProcessMonitor::processFinished";
      return;
   }

   JobInfo* jobInfo(process->jobInfo());
   QString msg(jobInfo->get(JobInfo::BaseName));

   if (process->status() == Process::Error) {
      msg += " has failed:\n";
      msg += process->comment();
      QMsgBox::warning(this, "IQmol", msg);
   }else {
      msg += " has finished.";
      if (jobInfo->localFilesExist()) {
         resultsAvailable(jobInfo);
         QMsgBox::information(this, "IQmol", msg);
      }else {
         msg += "\nCopy results from server?";
         if (QMsgBox::question(this, "IQmol", msg) == QMessageBox::Ok) {
            copyResults(process);
         }
      }
   }
}
Пример #3
0
// This only needs to implement the actions that are different that those for
// queryProcess()
void ProcessMonitor::on_processTable_cellDoubleClicked(int, int) 
{
   Process* process(getSelectedProcess());
   if (!process) return;

   switch (process->status()) 
   {
      case Process::Error:
         if (process->jobInfo()->localFilesExist()) {
            process->viewOutput();
         }else {
            QString msg = "Job failed:\n";
            msg += process->comment();
            QMsgBox::information(this, "IQmol", msg);
         }
         break;

      case Process::Finished:
         if (process->jobInfo()->localFilesExist()) {
            resultsAvailable(process->jobInfo());
         }else {
            QString msg("Copy results from server?");
            if (QMsgBox::question(this, "IQmol", msg) == QMessageBox::Ok) copyResults(process);
          }
         break;

      default:
         queryProcess(process);
         break;
   } 
}
Пример #4
0
TestFetchContacts::TestFetchContacts(const QList<QContactLocalId> &contactIds,
        Event event, TestExpectation *exp) : QObject(exp),
        mContactIds(contactIds), mEvent(event), mExp(exp)
{
    QContactFetchByIdRequest *request = new QContactFetchByIdRequest();
    connect(request,
            SIGNAL(resultsAvailable()),
            SLOT(onContactsFetched()));
    request->setManager(mExp->contactManager());
    request->setLocalIds(contactIds);
    QVERIFY(request->start());
}
Пример #5
0
void ProcessMonitor::resultsCopied()
{
qDebug() << "ProcessMonitor::resultsCopied called";
   ServerTask::CopyResults* task = qobject_cast<ServerTask::CopyResults*>(sender());
   if (!task) {
      qDebug() << "Failed to cast CopyResults from sender";
      return;
   }

   QString errorMessage(task->errorMessage());
   Process* process(task->process());
   task->deleteLater();

   if (errorMessage.isEmpty()) {
      process->jobInfo()->localFilesExist(true);
      resultsAvailable(process->jobInfo());
   }else {
      QString msg("Problem copying files for job ");
      msg += process->name() + " from server " + process->serverName() + ":\n";
      msg += errorMessage;
      QMsgBox::warning(this, "IQmol", msg);
   }
}
Пример #6
0
SeasideCache::SeasideCache()
    : m_manager(managerName())
#ifdef HAS_MLITE
    , m_displayLabelOrderConf(QLatin1String("/org/nemomobile/contacts/display_label_order"))
#endif
    , m_resultsRead(0)
    , m_populated(0)
    , m_cacheIndex(0)
    , m_queryIndex(0)
    , m_selfId(0)
    , m_fetchFilter(SeasideFilteredModel::FilterFavorites)
    , m_displayLabelOrder(SeasideFilteredModel::FirstNameFirst)
    , m_updatesPending(true)
    , m_refreshRequired(false)
{
    Q_ASSERT(!instance);
    instance = this;

    m_timer.start();

#ifdef HAS_MLITE
    connect(&m_displayLabelOrderConf, SIGNAL(valueChanged()), this, SLOT(displayLabelOrderChanged()));
    QVariant displayLabelOrder = m_displayLabelOrderConf.value();
    if (displayLabelOrder.isValid())
        m_displayLabelOrder = SeasideFilteredModel::DisplayLabelOrder(displayLabelOrder.toInt());
#endif

    connect(&m_manager, SIGNAL(dataChanged()), this, SLOT(updateContacts()));
    connect(&m_manager, SIGNAL(contactsChanged(QList<QContactLocalId>)),
            this, SLOT(updateContacts(QList<QContactLocalId>)));
    connect(&m_manager, SIGNAL(contactsAdded(QList<QContactLocalId>)),
            this, SLOT(updateContacts(QList<QContactLocalId>)));
    connect(&m_manager, SIGNAL(contactsRemoved(QList<QContactLocalId>)),
            this, SLOT(contactsRemoved(QList<QContactLocalId>)));

    connect(&m_fetchRequest, SIGNAL(resultsAvailable()), this, SLOT(contactsAvailable()));
    connect(&m_contactIdRequest, SIGNAL(resultsAvailable()), this, SLOT(contactIdsAvailable()));

    connect(&m_fetchRequest, SIGNAL(stateChanged(QContactAbstractRequest::State)),
            this, SLOT(requestStateChanged(QContactAbstractRequest::State)));
    connect(&m_contactIdRequest, SIGNAL(stateChanged(QContactAbstractRequest::State)),
            this, SLOT(requestStateChanged(QContactAbstractRequest::State)));
    connect(&m_removeRequest, SIGNAL(stateChanged(QContactAbstractRequest::State)),
            this, SLOT(requestStateChanged(QContactAbstractRequest::State)));
    connect(&m_saveRequest, SIGNAL(stateChanged(QContactAbstractRequest::State)),
            this, SLOT(requestStateChanged(QContactAbstractRequest::State)));

    m_fetchRequest.setManager(&m_manager);
    m_removeRequest.setManager(&m_manager);
    m_saveRequest.setManager(&m_manager);

#ifdef SEASIDE_SPARQL_QUERIES
    m_contactIdRequest.setQueryData(true);
    m_contactIdRequest.setFavoritesOnly(true);
    m_contactIdRequest.setSortOnFirstName(m_displayLabelOrder == SeasideFilteredModel::FirstNameFirst);

    m_contactIdRequest.start();
#else
    m_selfId = m_manager.selfContactId();
    m_contactIdRequest.setManager(&m_manager);

    QContactFetchHint fetchHint;
    fetchHint.setOptimizationHints(QContactFetchHint::NoRelationships
            | QContactFetchHint::NoActionPreferences
            | QContactFetchHint::NoBinaryBlobs);
    fetchHint.setDetailDefinitionsHint(QStringList()
            << QContactName::DefinitionName
            << QContactAvatar::DefinitionName
            << QContactPhoneNumber::DefinitionName
            << QContactEmailAddress::DefinitionName
            << QContactOrganization::DefinitionName
            << QContactOnlineAccount::DefinitionName);

    m_fetchRequest.setFetchHint(fetchHint);
    m_fetchRequest.setFilter(QContactFavorite::match());

    QContactSortOrder firstLabelOrder;
    firstLabelOrder.setDetailDefinitionName(
                QContactName::DefinitionName, QContactName::FieldFirstName);
    firstLabelOrder.setCaseSensitivity(Qt::CaseInsensitive);
    firstLabelOrder.setDirection(Qt::AscendingOrder);
    firstLabelOrder.setBlankPolicy(QContactSortOrder::BlanksFirst);

    QContactSortOrder secondLabelOrder;
    secondLabelOrder.setDetailDefinitionName(
                QContactName::DefinitionName, QContactName::FieldLastName);
    secondLabelOrder.setCaseSensitivity(Qt::CaseInsensitive);
    secondLabelOrder.setDirection(Qt::AscendingOrder);
    secondLabelOrder.setBlankPolicy(QContactSortOrder::BlanksFirst);

    QList<QContactSortOrder> sorting = m_displayLabelOrder == SeasideFilteredModel::FirstNameFirst
            ? (QList<QContactSortOrder>() << firstLabelOrder << secondLabelOrder)
            : (QList<QContactSortOrder>() << secondLabelOrder << firstLabelOrder);

    m_fetchRequest.setSorting(sorting);
    m_contactIdRequest.setSorting(sorting);

    m_fetchRequest.start();
#endif

}
Пример #7
0
void ProcessMonitor::openOutput()
{
   Process* process(getSelectedProcess());
   if (process) resultsAvailable(process->jobInfo());
}