Пример #1
0
void CreateEditPage::storeAndExit(void)
{
	bool success;

	QNdefMessage message = prepareDataForStorage();
	if (message.isEmpty() == true) {
		goto fail;
	}

	if (m_tag == TagStorage::NULL_TAG) {
		success = TagStorage::storage()->append(m_name->contents(), 
							message);
	} else if (m_tag == TagStorage::TEMPORARY_TAG) {
		TagStorage::storage()->remove(TagStorage::TEMPORARY_TAG);
		success = TagStorage::storage()->append(m_name->contents(), 
							message);
	} else {
		success = TagStorage::storage()->update(m_tag,
							m_name->contents(),
							message);
	}

	if (success == false) {
		goto fail;
	}

	dismiss();
	return;

fail:
	MMessageBox *box = new MMessageBox(tr("Cannot store the tag. "));
	box->appear(MSceneWindow::DestroyWhenDismissed);
}
Пример #2
0
void CreateEditPage::load(void)
{
	const Tag *tag = TagStorage::storage()->tag(m_tag);	

	if (m_tag == TagStorage::TEMPORARY_TAG) {
		setDefaultName(tr("Harvested tag"));
	} else {
		m_name->setContents(tag->name());
	}

	if (setupData(tag->message()) == false) {
		goto fail;
	} else {
		setContentValidity(true);
	}

	return;

fail:
	setupNewData();
	MMessageBox *box = new MMessageBox(tr("Cannot read the tag. "
					      "The tag contents may be "
					      "invalid. "));
	box->appear(MSceneWindow::DestroyWhenDismissed);	
}
void
OfflineBrief::setToggle (
        bool toggle)
{
    SYS_DEBUG ("toggle = %s", SYS_BOOL (toggle));
    /*
     * Don't do anything if we already in the desired mode
     */
    if (toggle && m_LastMode == QmDeviceMode::Flight)
        return;
    else if ((! toggle) && m_LastMode == QmDeviceMode::Normal)
        return;

#ifdef HAVE_QMSYSTEM
    if (! toggle)
    {
        MMessageBox* dialog =
                             //% "Exit offline mode?"
            new MMessageBox (qtTrId ("qtn_offl_exiting_title"),
                             //% "Connections will be restored."
                             qtTrId ("qtn_offl_exiting"),
                             M::YesButton | M::NoButton);
        /*
         * This will set the 'Normal' mode if dialog accepted
         */
        connect (dialog, SIGNAL (accepted ()),
                 SLOT (processDialogResult ()));
        /*
         * This will switch back the button for the proper state
         */
        connect (dialog, SIGNAL (rejected ()),
                 this, SIGNAL (valuesChanged ()));
        dialog->appear (MApplication::activeWindow (),
                        MSceneWindow::DestroyWhenDone);
    }
    else
    {
        bool success = m_DevMode->setMode (QmDeviceMode::Flight);
        SYS_DEBUG ("m_DevMode->setMode (Flight) success: %s", SYS_BOOL (success));
        if (success)
        {
            m_infoBanner = new MBanner;
            m_infoBanner->setStyleName ("InformationBanner");
            m_infoBanner->setObjectName ("InfoBanner");

            //% "Closing all connections. Switching to offline mode."
            m_infoBanner->setTitle (qtTrId ("qtn_offl_entering"));
            m_infoBanner->appear (
                MApplication::activeWindow (),
                MSceneWindow::DestroyWhenDone);
            // Set to NULL, as will destroy itself
            m_infoBanner = 0;
        }
    }
#endif
}
Пример #4
0
void SwitchPage::switchToggled(bool toggle)
{
    MMessageBox *msgBox = new MMessageBox();

    if (toggle)
        msgBox->setText("The feature was enabled");
    else
        msgBox->setText("The feature was disabled");

    msgBox->appear(MDialog::DestroyWhenDone);
}
Пример #5
0
void LoginSheet::showLoginSuccessfulAndDismiss()
{
    MBasicSheetHeader *header = static_cast<MBasicSheetHeader*>(headerWidget());

    header->setProgressIndicatorVisible(false);

    MMessageBox *messageBox = new MMessageBox;

    //% "Access Granted!"
    messageBox->setTitle(qtTrId("xx_wg_sheets_connection_success"));
    //% "You are now able to use the requested services."
    messageBox->setText(qtTrId("xx_wg_sheets_connection_success_text"));

    connect(messageBox, SIGNAL(disappeared()), SLOT(dismiss()));
    messageBox->appear(MSceneWindow::DestroyWhenDone);
}
Пример #6
0
void MainPage::messageRead(const QNdefMessage contents)
{
	bool success;
	QNdefMessage in;
	QString name;

	if (contents.length() == 0) {
		success = false;
		goto done;
	}

	/* TODO: UI notification if conversion drops data? */

	/* Convert incoming data so we don't have to deal with this
	   mess later on -- Qt API could have had some consideration
	   for this */
	if (VCardNdefRecord::hasSupportedMimeType(contents[0]) &&
	    contents.length() == 1) {
		in << VCardNdefRecord::fromSupportedMimeType(contents[0]);
	} else if (BtNdefRecord::hasSupportedMimeType(contents[0]) &&
		   contents.length() == 1) {
		in << BtNdefRecord::fromSupportedMimeType(contents[0]);
	} else if (contents[0].isRecordType<NfcHandoverSelectNdefRecord>() &&
		   contents.length() == 2 &&
		   BtNdefRecord::hasSupportedMimeType(contents[1])) {
		in << contents[0];
		in << BtNdefRecord::fromSupportedMimeType(contents[1]);
	} else {
		in = contents;
	}

	mDebug(__func__) << "Saving temp";
	name = "Harvested tag";
	success = TagStorage::storage()->update(TagStorage::TEMPORARY_TAG,
						name, 
						in);
done:
	if (success == false) {
		MMessageBox *box = 
			new MMessageBox(tr("Cannot store the tag. "));
		box->appear(MSceneWindow::DestroyWhenDismissed);
	} else {
		mDebug(__func__) << "Editing temp";
		editTag(TagStorage::TEMPORARY_TAG);
	}
}
Пример #7
0
void SheetsPage::processFullscreenSaveSuccess()
{
    if (!fullScreenPhotoSheet)
        return;

    MBasicSheetHeader *header = qobject_cast<MBasicSheetHeader*>(fullScreenPhotoSheet->headerWidget());
    if (header) {
        header->setProgressIndicatorVisible(false);
    }
    MMessageBox *msg = new MMessageBox;
    //% "Save Completed!"
    msg->setTitle(qtTrId("xx_wg_sheets_save_completed"));
    //% "The photo was imported into your photo library, and is now accessible through the photo gallery viewer."
    msg->setText(qtTrId("xx_wg_sheets_save_completed_text"));

    connect(msg, SIGNAL(disappeared()), fullScreenPhotoSheet, SLOT(dismiss()));
    msg->appear(MSceneWindow::DestroyWhenDone);
}
Пример #8
0
void MainPage::showAbout(void)
{
	MLabel *label = 
		new MLabel(tr("<big>NFC Tag Builder</big><br>"
			      "<br>"
			      "<br>v%1"
			      "<br>"
			      "Copyright (c) 2012 Hannu Mallat<br>"
			      "<a href=\"http://hannu.mallat.fi/n9/nfctagbuilder\">http://hannu.mallat.fi/n9/nfctagbuilder</a><br>")
			   .arg(VERSION));
	label->setWordWrap(true);
        label->setAlignment(Qt::AlignHCenter);
        label->setStyleName("CommonQueryText");
	connect(label, SIGNAL(linkActivated(const QString &)),
		this, SLOT(linkActivated(const QString &)));

	MMessageBox *box = new MMessageBox();
	box->setCentralWidget(label);

	box->appear();
}