Пример #1
0
void KSecretCreateCollectionJob::newPasswordJobResult(KJob *job)
{
    AbstractNewPasswordJob *npj = qobject_cast<AbstractNewPasswordJob*>(job);
    Q_ASSERT(npj);

    if(npj->cancelled()) {
        setCollection(0);
        setError(BackendErrorOther, i18n("Creating the secret collection was cancelled by the user."));
        dismiss(); // this will also emitResult()
        return;
    }

    // TODO: collection needs authentication methods, filenames, ...
    QString errorMessage;
    QString collId = createId();
    manager()->creatingCollection( collId );
    KSecretCollection *coll = KSecretCollection::create(collId, npj->password(),
                              manager(), errorMessage);
    if(!coll) {
        setCollection(0);
        setError(BackendErrorOther, errorMessage);
        dismiss(); // this will also emitResult()
        return;
    }
    coll->setLabel(label());

    // NOTE: coll has to be added to m_collections before serializing it for the
    //       first time, so when slotDirectoryChanged is called, the collection
    //       is already known.
    m_manager->addCollection(coll);

    if(locked()) {
        coll->lock();
    }

    setCollection(coll);
    // not yet time for  emitResult(); 
    // let the ACL dialog to pop before 
    AbstractUiManager *uiManager = BackendMaster::instance()->uiManager();
    AbstractAskAclPrefsJob *aclSubjob = uiManager->createAskAclPrefsJob(createCollectionInfo());
    if ( addSubjob( aclSubjob ) ) {
        connect(aclSubjob, SIGNAL(result(KJob*)),
                SLOT(askAclPrefsJobResult(KJob*)));
        aclSubjob->start();
    }
    else {
        qDebug() << "Cannot add aclSubjob";
        setErrorText( i18n("Cannot launch ACL preferences job") );
        emitResult();
    }
}
Пример #2
0
Profile::Profile(CollectionInterface* parent, Person* p) : ItemBase(nullptr),
d_ptr(new ProfilePrivate())
{
    if (parent)
        setCollection(parent);
    d_ptr->m_Person = p;
}
Пример #3
0
  bool onEvent(Event& ev)
  {
    switch (ev.code) {
    case Event::PREVIOUS:
      setCollection(m_collection-1,0);
      return true;
    case Event::NEXT:
      setCollection(m_collection+1,0);
      return true;
//     case Event::SELECT:
//       for (int i=0; i<THUMB_COUNT && i+m_dispbase<m_dispcount; i++) {
// 	m_thumbs[i]->transparent(true);
//       }
//       m_thumbs[m_dispbase+ev.x]->transparent(false);
//       m_game->gotoLevel(m_levels->collectionLevel(m_collection,m_dispbase+ev.x));
//       add( new LevelLauncher(m_levels->collectionLevel(m_collection,m_dispbase+ev.x), m_thumbs[m_dispbase+ev.x]->canvas()) );
//       //Event closeEvent(Event::CLOSE);
//       //m_parent->dispatchEvent(closeEvent);
//       return true;
    }
    return MenuPage::onEvent(ev);
  }
Пример #4
0
    LevelSelector(GameControl* game, int initialLevel)
        : m_game(game),
          m_levels(game->m_levels),
          m_collection(0),
          m_dispbase(0),
          m_dispcount(0)
    {
        m_scroll = new ScrollArea();
        m_scroll->fitToParent(true);
        m_scroll->virtualSize(Vec2(SCREEN_WIDTH,SCREEN_HEIGHT));

        m_content->add(m_scroll,0,0);
        fitToParent(true);

        int levelInC;
        m_collection = m_levels->collectionFromLevel(initialLevel,&levelInC);
        setCollection(m_collection, levelInC);
    }