/*!
Opens the Add to Contacts popup
*/
void CntServiceAssignContactCardView::addToContacts()
{  
    CNT_ENTRY
    
    HbDialog* popup = new HbDialog();
    popup->setDismissPolicy(HbDialog::NoDismiss);
    popup->setHeadingWidget(
            new HbLabel(hbTrId("txt_phob_title_add_to_contacts"), popup));
    popup->setAttribute(Qt::WA_DeleteOnClose);
    popup->setTimeout( HbPopup::NoTimeout );
    popup->addAction(
            new HbAction(hbTrId("txt_common_button_cancel"), popup));

    HbWidget* buttonWidget = new HbWidget(popup);
    QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(Qt::Vertical);
    
    HbPushButton* addButton = new HbPushButton(buttonWidget);
    addButton->setStretched(true);
    addButton->setText(hbTrId("txt_phob_button_save_as_a_new_contact"));
    HbIcon plusIcon("qtg_mono_plus");
    addButton->setIcon(plusIcon);
    connect(addButton, SIGNAL(clicked()), popup, SLOT(close()));
    connect(addButton, SIGNAL(clicked()), this, SLOT(saveNew()));
    connect(addButton, SIGNAL(longPress(QPointF)), popup, SLOT(close()));
    connect(addButton, SIGNAL(longPress(QPointF)), this, SLOT(saveNew()));
    
    HbPushButton* updateButton = new HbPushButton(buttonWidget);
    updateButton->setStretched(true);
    updateButton->setText(hbTrId("txt_phob_button_update_existing_contact"));
    updateButton->setIcon(plusIcon);
    connect(updateButton, SIGNAL(clicked()), popup, SLOT(close()));
    connect(updateButton, SIGNAL(clicked()), this, SLOT(updateExisting()));
    connect(updateButton, SIGNAL(longPress(QPointF)), popup, SLOT(close()));
    connect(updateButton, SIGNAL(longPress(QPointF)), this, SLOT(updateExisting()));
    
    
    layout->addItem(addButton);
    layout->addItem(updateButton);
    
    buttonWidget->setLayout(layout);
    popup->setContentWidget(buttonWidget);

    popup->open();
    
    CNT_EXIT
}
Example #2
0
TableView::TableView(QWidget *parent) : QTableView(parent)
{
	ui.setupUi(this);
	QFile cssFile(":table-css");
	cssFile.open(QIODevice::ReadOnly);
	QTextStream reader(&cssFile);
	QString css = reader.readAll();
	ui.tableView->setStyleSheet(css);
	/* There`s mostly a need for a Mac fix here too. */
	if (qApp->style()->objectName() == "gtk+")
		ui.groupBox->layout()->setContentsMargins(0, 9, 0, 0);
	else
		ui.groupBox->layout()->setContentsMargins(0, 0, 0, 0);
	QIcon plusIcon(":plus");
	plusBtn = new QPushButton(plusIcon, QString(), ui.groupBox);
	plusBtn->setFlat(true);
	plusBtn->setToolTip(tr("Add Cylinder"));
	plusBtn->setIconSize(QSize(16,16));
	connect(plusBtn, SIGNAL(clicked(bool)), this, SIGNAL(addButtonClicked()));
}