void AccountSetupPage::createContent()
{
    MApplicationPage::createContent();
    setContentsMargins(0, 0, 0, 0);
    setPannable(true);
    //% "Mail"
    setTitle(qtTrId("xx_page_title"));

    MLayout *layout = new MLayout(centralWidget());

    MLinearLayoutPolicy *policy = new MLinearLayoutPolicy(layout, Qt::Vertical);

    //% "New mail account"
    creatLabel (policy, ("<b>" + qtTrId("xx_new_mail_account") + "<b>"), true);

    //% "We need to take some details to setup your account."
    creatLabel (policy, qtTrId("xx_need_account_detail"), true);
     
    // Prompt the user for name
    //% "What's your name?"
    creatLabel(policy, qtTrId("xx_enter_your_name"));
    m_username = new MTextEdit(MTextEditModel::SingleLine, "", this);
    m_username->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    policy->addItem(m_username);
    policy->setItemSpacing(policy->indexOf(m_username), 5);

    // Prompt the user for email address
    //% "Email address"
    creatLabel (policy, qtTrId("xx_email_address"));
    m_emailAddress = new MTextEdit(MTextEditModel::SingleLine, "", this);
    m_emailAddress->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    policy->addItem(m_emailAddress);
    policy->setItemSpacing(policy->indexOf(m_emailAddress), 5);

    // Prompt the user for password
    //% "Password"
    creatLabel(policy, qtTrId("xx_password"));
    m_password = new MTextEdit(MTextEditModel::SingleLine, "", this);
    m_password->setEchoMode(MTextEditModel::Password);
    m_password->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    policy->addItem(m_password);
    policy->setItemSpacing(policy->indexOf(m_password), 5);

    // Setup button
    //% "Setup account"
    MButton *button = new MButton(qtTrId("xx_setup_account_button_label"), this);
    button->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    connect(button, SIGNAL(clicked(bool)), this, SLOT(setupAccount()));
    policy->addItem(button);
    policy->addStretch();

    // Settings menu
    //% "Settings"
    MAction *action = new MAction(qtTrId("xx_settings_actions"), this);
    action->setLocation(MAction::ApplicationMenuLocation);
    connect(action, SIGNAL(triggered(bool)), this, SIGNAL(emailSettingsTriggered()));
    addAction(action);
}
Esempio n. 2
0
void AppWindow::addPage(MApplicationPage *page)
{
	MAction *action = new MAction(page->title(), this);
	action->setLocation(MAction::ToolBarLocation);
//	action->setCheckable(true);
	action->setActionGroup(actionGroup);
	addAction(action);

	m_pages[action] = page;
}
void ToolBarPage::setMenuActionsVisible(bool visible)
{
    QList<QAction *> acts = actions();
    int actsSize = acts.size();
    for (int i = 0; i < actsSize; ++i) {
        MAction *action = qobject_cast<MAction *>(acts[i]);
        if (action && action->location().testFlag(MAction::ApplicationMenuLocation)) {
            action->setVisible(visible);
        }
    }
}
QAction *SampleWindow::createAction(const QString &name, bool checked)
{
    MAction *action = new MAction(name, this);
    action->setLocation(MAction::ToolBarLocation);
    action->setCheckable(true);
    action->setChecked(checked);
    action->setActionGroup(actionGroup);
    addAction(action);

    return action;
}
Esempio n. 5
0
int MItem::expandAction( const WString& actionName, WString& command )
{
    WVList actions;
    addActions( actions );
    for( int i=0; i<actions.count(); i++ ) {
        MAction* action = (MAction*)actions[i];
        if( action->name().match( actionName ) ) {
            return( expandAction( action, command ) );
        }
    }
    return( -1 );
}
int ToolBarPage::buttonCount()
{
    int count = 0;
    QList<QAction *> acts = actions();
    for (int i = 0; i < acts.size(); ++i) {
        MAction *action = qobject_cast<MAction *>(acts[i]);
        if (action && action->location().testFlag(MAction::ToolBarLocation)) {
            count++;
        }
    }
    return count;
}
void FoursquareAuthPage::createContent(void)
{
	MApplicationPage::createContent();
	setStyleName("CommonApplicationPage");
	setPannable(false);

	MAction *cancelAction = new MAction(tr("Cancel"), this);
	cancelAction->setLocation(MAction::ToolBarLocation);
	connect(cancelAction, SIGNAL(triggered()),
		this, SLOT(dismiss()));
	addAction(cancelAction);

	QGraphicsAnchorLayout *layout = new QGraphicsAnchorLayout();
	layout->setContentsMargins(0, 0, 0, 0);

	m_header = new ViewHeader(tr("Foursquare authentication"));

	layout->addCornerAnchors(m_header, Qt::TopLeftCorner,
				 layout, Qt::TopLeftCorner);
	layout->addCornerAnchors(m_header, Qt::TopRightCorner,
				 layout, Qt::TopRightCorner);

	QGraphicsGridLayout *subLayout = new QGraphicsGridLayout();
	layout->addCornerAnchors(subLayout, Qt::TopLeftCorner,
				 m_header, Qt::BottomLeftCorner);
 	layout->addCornerAnchors(subLayout, Qt::BottomRightCorner,
 				 layout, Qt::BottomRightCorner);

	m_view = new QGraphicsWebView();
	m_view->setResizesToContents(false);
	m_view->setSizePolicy(QSizePolicy::Ignored,
			      QSizePolicy::Ignored);
	connect(m_view, SIGNAL(loadStarted()),
		this, SLOT(pageLoadStarted()));
	connect(m_view, SIGNAL(loadFinished(bool)),
		this, SLOT(pageLoadFinished(bool)));

	subLayout->addItem(m_view, 0, 0);

	m_nam = new FoursquareAuthNetworkAccessManager(m_view->page()->networkAccessManager(), 
						       REDIRECT_URL,
						       this);
	connect(m_nam, SIGNAL(tokenReceived(QString)),
		this, SLOT(tokenReceived(QString)));

	m_view->page()->setNetworkAccessManager(m_nam);

	centralWidget()->setLayout(layout);

	Q_EMIT(created());
}
Esempio n. 8
0
void MainPage::createActions(void)
{
	MAction *newAction = new MAction("icon-m-toolbar-add", 
					 tr("Create a new tag"),
					 this);
	newAction->setLocation(MAction::ToolBarLocation);
 	connect(newAction, SIGNAL(triggered()),
 		this, SLOT(createTag()));
	addAction(newAction);

	MAction *killallAction = new MAction(tr("Remove all tags"),
					     this);
	killallAction->setLocation(MAction::ApplicationMenuLocation);
 	connect(killallAction, SIGNAL(triggered()),
 		this, SLOT(removeAllTags()));
	addAction(killallAction);

	MAction *aboutAction = new MAction(tr("About..."), this);
	aboutAction->setLocation(MAction::ApplicationMenuLocation);
 	connect(aboutAction, SIGNAL(triggered()),
 		this, SLOT(showAbout()));
	addAction(aboutAction);

	MAction *helpAction = new MAction(tr("Instructions..."), this);
	helpAction->setLocation(MAction::ApplicationMenuLocation);
 	connect(helpAction, SIGNAL(triggered()),
 		this, SLOT(showHelp()));
	addAction(helpAction);
}
void ToolBarPage::removeLast(int count)
{
    int removedCnt = 0;
    QList<QAction *> acts = actions();
    int actsSize = acts.size();
    for (int i = actsSize-1; i >= 0; i--) {
        MAction *action = qobject_cast<MAction *>(acts[i]);
        if (action && action->location().testFlag(MAction::ToolBarLocation)) {
            removeAction(action);
            removedCnt++;
            if (removedCnt >= count)
                break;
        }
    }
}
Esempio n. 10
0
void CalendarPage::createPageSpecificActions(void)
{
	MAction *eventAction = new MAction(tr("Event from calendar..."),
					   this);
	eventAction->setLocation(MAction::ApplicationMenuLocation);
	connect(eventAction, SIGNAL(triggered()),
		this, SLOT(chooseEvent()));
	addAction(eventAction);
	
	MAction *todoAction = new MAction(tr("Todo item from calendar..."),
					  this);
	todoAction->setLocation(MAction::ApplicationMenuLocation);
	connect(todoAction, SIGNAL(triggered()),
		this, SLOT(chooseTodo()));
	addAction(todoAction);
}
void ToolBarPage::clearToolbarActions()
{
    QList<QAction *> acts = actions();
    int actsSize = acts.size();
    for (int i = 0; i < actsSize; ++i) {
        MAction *action = qobject_cast<MAction *>(acts[i]);
        if (action && action->location().testFlag(MAction::ToolBarLocation)) {
            removeAction(action);
        }
    }
    MApplicationWindow* window = ((MApplicationWindow*)MApplication::activeWindow());
    acts = window->actions();
    actsSize = acts.size();
    for (int i = 0; i < actsSize; ++i) {
        window->removeAction(acts[i]);
    }
}
void ConversationPage::createActions()
{
    //% "Delete"
    MAction *action = new MAction(qtTrId("xx_delete_action"), this);
    action->setLocation(MAction::ApplicationMenuLocation);
    addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(deleteActionTriggered()));

    //% "Reply"
    action = new MAction(qtTrId("xx_reply_action"), this);
    action->setLocation(MAction::ApplicationMenuLocation);
    addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(replyActionTriggered()));

    //% "Reply to all"
    action = new MAction(qtTrId("xx_reply_all_action"), this);
    action->setLocation(MAction::ApplicationMenuLocation);
    addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(replyAllActionTriggered()));

    //% "Forward"
    action = new MAction(qtTrId("xx_forward_action"), this);
    action->setLocation(MAction::ApplicationMenuLocation);
    addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(forwardActionTriggered()));

    // "Delete" context action item
    action = new MAction(qtTrId("xx_delete_action"), this);
    action->setLocation(MAction::ObjectMenuLocation);
    addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(deleteActionTriggered()));

    // "Reply" context action item
    action = new MAction(qtTrId("xx_reply_action"), this);
    action->setLocation(MAction::ObjectMenuLocation);
    addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(replyActionTriggered()));

    // "Reply to all" context action item
    action = new MAction(qtTrId("xx_reply_all_action"), this);
    action->setLocation(MAction::ObjectMenuLocation);
    addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(replyAllActionTriggered()));

    // "Forward" context action item
    action = new MAction(qtTrId("xx_forward_action"), this);
    action->setLocation(MAction::ObjectMenuLocation);
    addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(forwardActionTriggered()));
}
void ToolBarPage::toolsConfiguration(int count)
{
    currentConfiguration = tools;
    int currentCount = buttonCount();

    if (currentCount < count) {
        QString icons[5] = {"icon-m-toolbar-list",
                            "icon-m-toolbar-grid",
                            "icon-m-toolbar-reply",
                            "icon-m-toolbar-stop",
                            "icon-m-toolbar-forward"};
        QString invertedIcons[5] = {"icon-m-toolbar-list-white",
                                    "icon-m-toolbar-grid-white",
                                    "icon-m-toolbar-reply-white",
                                    "icon-m-toolbar-stop-white",
                                    "icon-m-toolbar-forward-white"};

        for (int i=currentCount; i<qMin(5, count); i++) {
            MAction *action;
            if (MApplication::instance()->objectName() == "widgetsgallery") {
                action = new MAction(icons[i], "", this);
            } else {
                action = new MAction(invertedIcons[i], "", this);
            }
            action->setObjectName("configurationAction");
            action->setLocation(MAction::ToolBarLocation);
            addAction(action);
            switch (i) {
            case 0:
                connect(action, SIGNAL(triggered()), this, SLOT(showCallDataAsList()));
                break;
            case 1:
                connect(action, SIGNAL(triggered()), this, SLOT(showCallDataAsGrid()));
                break;
            default:
                break;
            }
        }
    } else if (currentCount > count){
        removeLast(currentCount - count);
    }
}
void ToolBarPage::textButtonsConfiguration()
{
    initDefaultViewToolBar();

    //% "Save"
    MAction* action = new MAction(qtTrId("xx_toolbar_page_tools_save"), this);
    action->setObjectName("saveAction");
    action->setLocation(MAction::ToolBarLocation);
    addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(disappear()));

    //% "Cancel"
    action = new MAction(qtTrId("xx_toolbar_page_tools_cancel"), this);
    action->setObjectName("cancelAction");
    action->setLocation(MAction::ToolBarLocation);
    addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(reset()));

    currentConfiguration = textButtons;
}
QVector<MAction*>
ResetApplet::viewMenuItems()
{
    MAction            *helpAction;
    QVector<MAction*>   vector;

    SYS_DEBUG ("");
    helpAction = new MAction (
            //% "User Guide"
            qtTrId ("qtn_comm_userguide"), 
            pageMain (0));
    helpAction->setLocation (MAction::ApplicationMenuLocation);

    connect (helpAction, SIGNAL (triggered (bool)),
             this, SLOT (userGuide ()));

    vector.append(helpAction);

    return vector;
}
Esempio n. 16
0
AppWindow::AppWindow()
	: m_current_page(NULL)
	, m_busy(false)
{
	setObjectName("AppWindow");

	// We want the toolbar to show actions as tabs. I.e., be a tab bar.
	setToolbarViewType(MToolBar::tabType);

	actionGroup = new QActionGroup(this);
	actionGroup->setExclusive(true);
	connect(actionGroup, SIGNAL(triggered(QAction*)), SLOT(showPageForAction(QAction*)));

	// Пункты меню
	{
		MAction *action = new MAction("Options", this);
		action->setLocation(MAction::ApplicationMenuLocation);
		connect(action, SIGNAL(triggered()), SIGNAL(sig_showOptionsPage()));
		addAction(action);
	}
	{
		MAction *action = new MAction("Log", this);
		action->setLocation(MAction::ApplicationMenuLocation);
		connect(action, SIGNAL(triggered()), SIGNAL(sig_showLogPage()));
		addAction(action);
	}
	{
		MAction *action = new MAction("Quit", this);
		action->setLocation(MAction::ApplicationMenuLocation);
		connect(action, SIGNAL(triggered()), SLOT(close()));
		addAction(action);
	}

	show();
}
void PeopleApplication::createEditPage(const QModelIndex &index, const QString& title)
{
    if (m_editPage)
        return;

    QModelIndex useIndex;

    if (index.isValid())
        useIndex = index;
    else
        useIndex = m_currentIndex;

    if (useIndex.isValid())
        m_editModel = SeasideSyncModel::createPersonModel(useIndex);
    else  // create empty edit model to add new contact
        m_editModel = new SeasidePersonModel;
    MWidgetController *person = new MWidgetController(m_editModel);
    person->setViewType("personEdit");

    m_editModelModified = false;
    connect(m_editModel, SIGNAL(modified(QList<const char*>)),
            this, SLOT(editModified()));

    m_editPage = new MApplicationPage;
    if (title.isNull())
        m_editPage->setTitle(QObject::tr("Edit Contact","Title for edit screen"));
    else
        m_editPage->setTitle(title);
    m_editPage->setCentralWidget(person);

    MAction *action = new MAction(QObject::tr("<b>Save</b>","Save toolbar button for edit screen"), this);
    action->setLocation(MAction::ApplicationMenuLocation);
    m_editPage->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(editSave()));

    connect(m_editPage, SIGNAL(backButtonClicked()), this, SLOT(editBack()));

    m_editPage->appear(MApplicationPage::DestroyWhenDismissed);
}
Esempio n. 18
0
int MItem::expandAction( MAction* action, WString& command )
{
    WFileName fn;
    if( _isTarget ) {
        absName( fn );
    } else {
        WVList actions;
        int ocount = addActions( actions );
        if( !action ) {
            int icount = actions.count();
            if( icount > 0 ) {
                for( int i=0; i<icount; i++ ) {
                    MAction* act = (MAction*)actions[i];
                    if( act->defAction() ) {
                        if( act->okForMask() || !isMask() ) {
                            action = act;
                            break;
                        }
                    }
                }
            }
        }
        if( action ) {
            int ix = actions.indexOfSame( action );
            if( ix < 0 ) {
                action = NULL;
            } else if( ix >= ocount ) {
                absResult( fn );
            } else {
                absName( fn );
            }
        }
    }
    if( action ) {
        WVList* states = findActionStates( action );
        return( action->expand( command, &fn, _component->mask(), states, _component->mode() ) );
    }
    return( -1 );
}
Esempio n. 19
0
void MConfig::enumAccel( WObject *obj, bcbk fn )
{
    int         icount;
    WKeyCode    key;
    int         i;

    icount = _actions.count();
    for( i=0; i < icount; i++ ) {
        MAction *action;
        action = (MAction *)_actions[i];
        key = action->menuAccel();
        if( key != WKeyNone ) {
            if( (obj->*fn)( key ) ) return;
        }
    }
    icount = _rules.count();
    for( i=0; i < icount; i++ ) {
        MRule   *rule;
        rule = (MRule *)_rules[i];
        if( rule->enumAccel( obj, fn ) ) return;
    }
}
void PeopleApplication::createDetailPage(const QModelIndex &index)
{
    if (m_detailPage)
        return;

    if (!index.isValid())
        return;

    searchCancel();

    m_currentIndex = index;

    m_currentPerson = new SeasidePerson(index);
    m_currentPerson->setViewType("personDetail");

    connect(m_currentPerson, SIGNAL(callNumber(const QString&)),
            this, SLOT(callNumber(const QString&)));
    connect(m_currentPerson, SIGNAL(composeIM(const QString&)),
            this, SLOT(composeIM(const QString&)));
    connect(m_currentPerson, SIGNAL(composeSMS(const QString&)),
            this, SLOT(composeSMS(const QString&)));
    connect(m_currentPerson, SIGNAL(composeEmail(const QString&)),
            this, SLOT(composeEmail(const QString&)));
    connect(m_currentPerson, SIGNAL(viewRequest(qreal,qreal)),
            this, SLOT(scrollIntoView(qreal,qreal)));

    m_detailPage = new MApplicationPage;
    m_detailPage->setTitle(QObject::tr("Contact Detail","Title for detail view"));
    m_detailPage->setCentralWidget(m_currentPerson);

    MAction *action = new MAction(QObject::tr("<b>Edit</b>","Edit toolbar button to edit contact details"), this);
    action->setLocation(MAction::ApplicationMenuLocation);
    m_detailPage->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(editCurrent()));

    connect(m_detailPage, SIGNAL(backButtonClicked()), this, SLOT(detailBack()));

    m_detailPage->appear(MApplicationPage::DestroyWhenDismissed);
}
void AlbumThumbnailsCellProcessor::processCell(MContentItem *cell)
{
    //% "Open"
    MAction *actionOpen = new MAction(qtTrId("Open"), cell);
    actionOpen->setLocation(MAction::ObjectMenuLocation);
    QObject::connect(actionOpen, SIGNAL(triggered()), albumList, SLOT(objectMenuOpen()));
    cell->addAction(actionOpen);
    
    //% "Share"
    MAction *actionShare = new MAction(qtTrId("Share"), cell);
    actionShare->setLocation(MAction::ObjectMenuLocation);
    QObject::connect(actionShare, SIGNAL(triggered()), albumList, SLOT(objectMenuShare()));
    cell->addAction(actionShare);

    //% "Delete"
    MAction *actionDelete = new MAction(qtTrId("Delete"), cell);
    actionDelete->setLocation(MAction::ObjectMenuLocation);
    QObject::connect(actionDelete, SIGNAL(triggered()), albumList, SLOT(objectMenuDelete()));
    cell->addAction(actionDelete);
}
Esempio n. 22
0
LookAlikeMainPrivate::LookAlikeMainPrivate(LookAlikeMain *q) :
    QObject(q),
    m_currentAction(0),
    q_ptr(q)
{
    // Less correct the problem with the DB first of all, if no other
    // application has dealt with it first.
    m_faceRecognitionResetter = new FaceRecognitionResetter();
    if (!m_faceRecognitionResetter->isDBCorrected()) {
        m_faceRecognitionResetter->dealWithDB(1);
    }

    m_galleryModel = new GalleryModel(this);
    m_galleryModel->setFaceRecognitionEnabled(true);
    QSparqlConnection *connection = m_galleryModel->sparqlConnection();
    m_trackerProvider = new TrackerContentProvider(connection, this);
    m_galleryModel->addContentProvider(m_trackerProvider);
    m_faceDatabaseProvider = new FaceDatabaseProvider(connection, this);
    m_faceTrackerProvider = new FaceTrackerProvider(connection, this);
    m_confirmedContactsListPage = new GalleryPeopleListPage(m_faceTrackerProvider->model());
    m_proposedContactsListPage = new GalleryPeopleListPage(m_faceDatabaseProvider);
    m_gridPage = new GalleryGridPage(*m_galleryModel);
    m_fullScreenPage = new GalleryFullScreenPage(*m_galleryModel);

    m_confirmedContactsListPage->setStyleName("GalleryPage");
    m_proposedContactsListPage->setStyleName("GalleryPage");
    m_gridPage->setStyleName("GalleryPage");
    m_fullScreenPage->setStyleName("GalleryPage");

    MAction* allTabAction = new MAction("icon-m-toolbar-all-content-white", "", q);
    allTabAction->setLocation(MAction::ToolBarLocation);
    allTabAction->setCheckable(true);

    MAction* confirmedContactsTabAction = new MAction("icon-m-toolbar-known-people-white", "", q);
    confirmedContactsTabAction->setLocation(MAction::ToolBarLocation);
    confirmedContactsTabAction->setCheckable(true);

    MAction* proposedContactsAction = new MAction("icon-m-toolbar-unknown-people-white", "", q);
    proposedContactsAction->setLocation(MAction::ToolBarLocation);
    proposedContactsAction->setCheckable(true);

    MAction* landscapeTabAction = new MAction("icon-m-toolbar-no-people-white", "", q);
    landscapeTabAction->setLocation(MAction::ToolBarLocation);
    landscapeTabAction->setCheckable(true);

    QList<QAction*> actions;
    actions.append(allTabAction);
    actions.append(confirmedContactsTabAction);
    actions.append(proposedContactsAction);
    actions.append(landscapeTabAction);

    MToolBar* toolbar = new MToolBar();
    toolbar->setStyleName("MToolbarTabStyleInverted");
    toolbar->setOpacity(0.9);
    toolbar->setViewType(MToolBar::tabType);
    toolbar->addActions(actions);

    m_toolbarAction = new MWidgetAction(q);
    m_toolbarAction->setLocation(MAction::ToolBarLocation);
    m_toolbarAction->setWidget(toolbar);

    m_confirmFaceAction = new MAction("Confirm faces", q);
    m_confirmFaceAction->setLocation(MAction::ApplicationMenuLocation);
    m_deleteFaceAction = new MAction("Delete faces", q);
    m_deleteFaceAction->setLocation(MAction::ApplicationMenuLocation);
    m_aboutAction = new MAction("About", q);
    m_aboutAction->setLocation(MAction::ApplicationMenuLocation);

    const QPixmap *pixmap = MTheme::pixmap("icon-m-toolbar-view-menu-dimmed-white");
    MImageWidget *menuImage = new MImageWidget();
    menuImage->setImage(pixmap->toImage());
    menuImage->setZoomFactor(1.f);
    menuImage->setMinimumWidth(88.f);
    MTheme::releasePixmap(pixmap);
    MWidgetAction* fakeAction= new MWidgetAction(q);
    fakeAction->setLocation(MAction::ToolBarLocation);
    fakeAction->setWidget(menuImage);

    m_confirmedContactsListPage->addAction(m_toolbarAction);
    m_confirmedContactsListPage->addAction(fakeAction);

    m_proposedContactsListPage->addAction(m_toolbarAction);
    m_proposedContactsListPage->addAction(fakeAction);

    connect(m_confirmedContactsListPage, SIGNAL(personSelected(QString,QString)),
            this, SLOT(onConfirmedContactSelected(QString,QString)));
    connect(m_proposedContactsListPage, SIGNAL(personSelected(QString,QString)),
            this, SLOT(onProposedContactPersonSelected(QString,QString)));
    connect(m_gridPage, SIGNAL(multiSelectionDone(QList<QUrl>)),
            this, SLOT(onMultiSelectionDone(QList<QUrl>)));
    connect(m_gridPage, SIGNAL(itemSelected(QUrl)),
            this, SLOT(onItemSelected(QUrl)));
    connect(m_fullScreenPage, SIGNAL(itemDeleted(QUrl)),
            m_faceDatabaseProvider, SLOT(update()));
    connect(m_trackerProvider, SIGNAL(dataChanged()),
            this, SLOT(onDataChanged()));
    connect(m_confirmFaceAction, SIGNAL(triggered()),
            this, SLOT(onConfirmFaceActionTriggered()));
    connect(m_deleteFaceAction, SIGNAL(triggered()),
            this, SLOT(onDeleteFaceActionTriggered()));
    connect(m_aboutAction, SIGNAL(triggered()),
            this, SLOT(onAboutActionTriggered()));
    connect(allTabAction, SIGNAL(toggled(bool)),
            this, SLOT(onAllTabActionToggled(bool)));
    connect(confirmedContactsTabAction, SIGNAL(toggled(bool)),
            this, SLOT(onConfirmedContactTabActionToggled(bool)));
    connect(proposedContactsAction, SIGNAL(toggled(bool)),
            this, SLOT(onProposedContactTabActionToggled(bool)));
    connect(landscapeTabAction, SIGNAL(toggled(bool)),
            this, SLOT(onLandscapeTabActionToggled(bool)));
    connect(m_gridPage, SIGNAL(appeared()),
            this, SLOT(onGridPageAppeared()));
    connect(m_fullScreenPage, SIGNAL(appeared()),
            this, SLOT(onFullscreenPageAppeared()));
    connect(m_fullScreenPage, SIGNAL(loadingActiveItemFailed(QString)),
            m_fullScreenPage, SLOT(disappear()));
    connect(m_galleryModel, SIGNAL(galleryItemsRemoved(int,int)),
            this, SLOT(onGalleryItemsRemoved()));

    allTabAction->toggle();
}
Esempio n. 23
0
void ArtistPage::createContent()
{
  MApplicationPage::createContent();

  QGraphicsWidget *panel = centralWidget();
  MLayout* layout = new MLayout(panel);
  m_policy = new MLinearLayoutPolicy(layout, Qt::Vertical);
  layout->setAnimation(NULL);
  panel->setLayout(layout);
  layout->setLandscapePolicy(m_policy);
  layout->setPortraitPolicy(m_policy);

  if (m_pageMode == ALL_ARTISTS) {
    // Menu Actions
    MAction* actionImportLastfm = new MAction(panel);
    actionImportLastfm->setText(tr("Import from Last.fm"));
    actionImportLastfm->setLocation(MAction::ApplicationMenuLocation);
    addAction(actionImportLastfm);
    connect(actionImportLastfm, SIGNAL(triggered()), this, SLOT(slotImportLastfm()));

    MAction* actionAddArtist = new MAction(panel);
    actionAddArtist->setText(tr("Add artist"));
    actionAddArtist->setLocation(MAction::ApplicationMenuLocation);
    addAction(actionAddArtist);
    connect(actionAddArtist, SIGNAL(triggered()), this, SLOT(slotAddArtist()));

    // Toolbar Actions
    MAction* actionFilter = new MAction("icon-m-toolbar-filter", "", this);
    actionFilter->setLocation(MAction::ToolBarLocation);
    addAction(actionFilter);
    connect(actionFilter, SIGNAL(triggered()), this, SLOT(slotShowFilter()));
  }

  MAction* actionRefresh = new MAction("icon-m-toolbar-refresh", "", this);
  actionRefresh->setLocation(MAction::ToolBarLocation);
  addAction(actionRefresh);
  connect(actionRefresh, SIGNAL(triggered()), this, SLOT(slotRefreshEvents()));

  MAction* actionSearch = new MAction("icon-m-toolbar-search", "", this);
  actionSearch->setLocation(MAction::ToolBarLocation);
  addAction(actionSearch);
  connect(actionSearch, SIGNAL(triggered()), this, SLOT(slotShowSearch()));

  // setup model
  m_artistsModel = new ArtistModel(m_dbStorage, artistsModelQuery());

  // filtering text box
  QGraphicsLinearLayout *containerLayout = new QGraphicsLinearLayout(Qt::Horizontal);

  MLabel* filterLabel = new MLabel(tr("Filter artist:"));
  containerLayout->addItem(filterLabel);

  m_filter = new MTextEdit(MTextEditModel::SingleLine, QString());
  containerLayout->addItem(m_filter);
  m_filter->setObjectName("CommonSingleInputField");
  connect(m_filter, SIGNAL(textChanged()), this, SLOT(slotFilterChanged()));

  m_filterWidget = new MWidget();
  m_filterWidget->setLayout(containerLayout);

  // No artist found label
  m_noArtistLabel = new MLabel(tr("No artist available, add them using one of "
                                  "menu options."));
  m_noArtistLabel->setAlignment(Qt::AlignCenter);
  if (m_artistsModel->rowCount() == 0)
    m_policy->addItem(m_noArtistLabel);

  // MList with fast view
  MList* artistsList = new MList();
  artistsList->setSelectionMode(MList::SingleSelection);

  // Content item creator and item model for the list
  artistsList->setCellCreator(new ArtistItemCreator(m_pageMode, m_dbStorage,
                                                    m_country));
  artistsList->setItemModel(m_artistsModel);
  m_policy->addItem(artistsList);

  connect(artistsList, SIGNAL(itemClicked(QModelIndex)),
           this, SLOT(slotArtistClicked(QModelIndex)));
  connect(DBManager::instance(m_dbStorage), SIGNAL(artistAdded(int,bool)),
           this, SLOT(slotArtistAdded(int,bool)));

  if (m_pageMode == ARTIST_NEAR_LOCATION_SEARCH) {
    //overwrite history
    MApplicationWindow* appWindow = applicationWindow();
    MScene* scene = appWindow->scene();
    MSceneManager* sceneManager = scene->sceneManager();
    QList<MSceneWindow*> history = sceneManager->pageHistory();
    if (history.last()->metaObject()->className() == NearLocationSearchPage::staticMetaObject.className()) {
      // overwrite history only if the last page is NearLocationSearchPage
      history.removeAt(history.size()-1);
      if (history.last()->metaObject()->className() != NearLocationMainPage::staticMetaObject.className()) {
        MApplicationPage* prevPage = new NearLocationMainPage();
        history << prevPage;
      }
      sceneManager->setPageHistory(history);
    }

    //search events
    m_lastfm->getEventsNearLocation(m_latitude, m_longitude, m_distance);
  }

  if (m_dbStorage == DBManager::DISK) {
    DBManager* db = DBManager::instance(m_dbStorage);
    QStringList incompleteArtists = db->incompleteArtists();
    foreach(QString artist, incompleteArtists) {
      m_lastfm->getEventsForArtist(artist);
    }
void ToolBarPage::addTab(int tabNumber)
{
    bool icons = false;

    switch (currentConfiguration) {
    case iconAndLabelTabsBottom:
    case iconAndLabelTabsTop:
    case iconTabsBottom:
    case iconTabsTop:
        icons = true;
        break;
    case textTabsBottom:
    case textTabsTop:
        icons = false;
        break;
    default:
        return;
    }

    switch (tabNumber) {
    case 1:
        {
            //% "Initiated"
            MAction *action = new MAction(icons ? "icon-m-telephony-callhistory-initiated" : "", qtTrId("xx_toolbar_page_tools_initiated"), this);
            action->setObjectName("callInitiatedAction");
            action->setLocation(MAction::ToolBarLocation);
            action->setCheckable(true);
            action->setChecked(true);
            connect(action, SIGNAL(triggered()), this, SLOT(populateCallInitiated()));
            addAction(action);
            populateCallInitiated();
            break;
        }
    case 2:
        {
            //% "Received"
            MAction *action = new MAction(icons ? "icon-m-telephony-callhistory-received" : "", qtTrId("xx_toolbar_page_tools_received"), this);
            action->setObjectName("callReceivedAction");
            action->setLocation(MAction::ToolBarLocation);
            action->setCheckable(true);
            connect(action, SIGNAL(triggered()), this, SLOT(populateCallReceived()));
            addAction(action);
            break;
        }
    case 3:
        {
            //% "Missed"
            MAction *action = new MAction(icons ? "icon-m-telephony-callhistory-missed" : "", qtTrId("xx_toolbar_page_tools_missed"), this);
            action->setObjectName("callMissedAction");
            action->setCheckable(true);
            connect(action, SIGNAL(triggered()), this, SLOT(populateCallMissed()));
            action->setLocation(MAction::ToolBarLocation);
            addAction(action);
            break;
        }
    case 4:
        {
            //% "Diverted"
            MAction *action = new MAction(icons ? "icon-m-telephony-call-diverted" : "", qtTrId("xx_toolbar_page_tools_diverted"), this);
            action->setObjectName("callDivertedAction");
            action->setCheckable(true);
            action->setLocation(MAction::ToolBarLocation);
            addAction(action);
            break;
        }
    case 5:
        {
            //% "Call"
            MAction *action = new MAction(icons ? "icon-m-telephony-call" : "", qtTrId("xx_toolbar_page_tools_call"), this);
            action->setObjectName("telephonyCellularAction");
            action->setCheckable(true);
            action->setLocation(MAction::ToolBarLocation);
            addAction(action);
            break;
        }
    default:
        break;
    }
}