예제 #1
0
MTSendDlg::MTSendDlg(QWidget *parent) :
    QWidget(parent, Qt::Window),
    m_bSent(false),
    already_init(false),
    ui(new Ui::MTSendDlg)
{
    ui->setupUi(this);

    this->installEventFilter(this);

    connect(this, SIGNAL(balancesChanged()), this, SLOT(onBalancesChanged()));

    connect(this, SIGNAL(ShowContact(QString)), Moneychanger::It(), SLOT(mc_showcontact_slot(QString)));
    connect(this, SIGNAL(ShowAccount(QString)), Moneychanger::It(), SLOT(mc_show_account_slot(QString)));
}
예제 #2
0
/*------------------------------------------------------------------------------*\
	MessageReceived( msg)
		-	
\*------------------------------------------------------------------------------*/
void BmPrefsSendMailView::MessageReceived( BMessage* msg) {
	try {
		switch( msg->what) {
			case BM_SELECTION_CHANGED: {
				int32 index = mAccListView->CurrentSelection( 0);
				ShowAccount( index);
				break;
			}
			case BM_TEXTFIELD_MODIFIED: {
				if (mCurrAcc) {
					BView* srcView = NULL;
					msg->FindPointer( "source", (void**)&srcView);
					BmTextControl* source = dynamic_cast<BmTextControl*>( srcView);
					if ( source == mAccountControl) {
						BmString oldName = mCurrAcc->Name();
						BmString newName = mAccountControl->Text();
						TheSmtpAccountList->RenameItem( oldName, newName);
						BmModelItemMap::const_iterator iter;
						// update any links to this smtp-account:
						BAutolock lock( TheIdentityList->ModelLocker());
						for( 	iter = TheIdentityList->begin(); 
								iter != TheIdentityList->end(); ++iter) {
							BmIdentity* ident 
								= dynamic_cast<BmIdentity*>( iter->second.Get());
							if (ident && ident->SMTPAccount()==oldName)
								ident->SMTPAccount( newName);
						}
					} else if ( source == mDomainControl)
						mCurrAcc->DomainToAnnounce( mDomainControl->Text());
					else if ( source == mLoginControl)
						mCurrAcc->Username( mLoginControl->Text());
					else if ( source == mPortControl)
						mCurrAcc->PortNr( uint16(atoi(mPortControl->Text())));
					else if ( source == mPwdControl)
						mCurrAcc->Password( mPwdControl->Text());
					else if ( source == mServerControl)
						mCurrAcc->SMTPServer( mServerControl->Text());
					else if ( source == mClientCertControl)
						mCurrAcc->ClientCertificate( mClientCertControl->Text());
					NoticeChange();
					UpdateState();
				}
				break;
			}
			case BM_PWD_STORED_CHANGED: {
				if (mCurrAcc) {
					mCurrAcc->PwdStoredOnDisk( mStorePwdControl->Value());
					NoticeChange();
				}
				UpdateState();
				break;
			}
			case BM_ENCRYPTION_SELECTED: {
				EncryptionSelected();
				NoticeChange();
				UpdateState();
				break;
			}
			case BM_AUTH_SELECTED: {
				AuthTypeSelected();
				NoticeChange();
				UpdateState();
				break;
			}
			case BM_CHECK_AND_SUGGEST: {
				if (mCurrAcc) {
					// ToDo: this should be made asynchronous (using messages):
					BmRef<BmSmtp> smtp( new BmSmtp( mCurrAcc->Key(), 
															  mCurrAcc.Get()));
					smtp->StartJobInThisThread( BmSmtp::BM_CHECK_CAPABILITIES_JOB);
					BmString suggestedAuthType = smtp->SuggestAuthType();
					if (suggestedAuthType.Length())
						mAuthControl->MarkItem( suggestedAuthType.String());
					else
						mAuthControl->MarkItem( BM_NoItemLabel.String());
					AuthTypeSelected();
					if (smtp->SupportsTLS())
						mEncryptionControl->MarkItem( BmSmtpAccount::ENCR_STARTTLS);
					else
						mEncryptionControl->MarkItem( BM_NoItemLabel.String());
					EncryptionSelected();
					NoticeChange();
					UpdateState();
				}
				break;
			}
			case BM_CLIENT_CERT_SELECTED: {
				entry_ref certRef;
				if (msg->FindRef( "refs", 0, &certRef) != B_OK) {
					// first step, let user select new certificate:
					if (!mClientCertPanel) {
						BmString certPath = TheNetEndpointRoster->GetCertPath();
						entry_ref eref;
						status_t err = get_ref_for_path(certPath.String(), &eref);
						mClientCertPanel = new BFilePanel( 
							B_OPEN_PANEL, new BMessenger(this), 
							err == B_OK ? &eref : NULL, B_FILE_NODE, false, msg
						);
					}
					mClientCertPanel->Show();
				} else {
					// second step, set data accordingly:
					mCurrAcc->ClientCertificate(certRef.name);
					mClientCertControl->SetText(certRef.name);
					NoticeChange();
					UpdateState();
				}
				break;
			}
			case BM_CLEAR_ACCEPTED_CERT: {
				mCurrAcc->AcceptedCertID("");
				mAcceptedCertControl->SetText("");
				NoticeChange();
				break;
			}
			case BM_POP_SELECTED: {
				BMenuItem* item = mPopControl->Menu()->FindMarked();
				if (item && BM_NoItemLabel != item->Label())
					mCurrAcc->AccForSmtpAfterPop( item->Label());
				else
					mCurrAcc->AccForSmtpAfterPop( "");
				NoticeChange();
				UpdateState();
				break;
			}
			case BM_ADD_ACCOUNT: {
				BmString key( "new account");
				for( int32 i=1; TheSmtpAccountList->FindItemByKey( key); ++i) {
					key = BmString("new account_")<<i;
				}
				TheSmtpAccountList->AddItemToList( new BmSmtpAccount( key.String(), 
															  TheSmtpAccountList.Get()));
				mAccountControl->MakeFocus( true);
				mAccountControl->TextView()->SelectAll();
				NoticeChange();
				break;
			}
			case BM_REMOVE_ACCOUNT: {
				int32 buttonPressed;
				if (msg->FindInt32( "which", &buttonPressed) != B_OK) {
					// first step, ask user about it:
					BAlert* alert = new BAlert( 
						"Remove Mail-Account", 
					 	(BmString("Are you sure about removing the account <") 
					 		<< mCurrAcc->Name() << ">?").String(),
						"Remove", "Cancel", NULL, B_WIDTH_AS_USUAL,
						B_WARNING_ALERT
					);
					alert->SetShortcut( 1, B_ESCAPE);
					alert->Go( new BInvoker( new BMessage(BM_REMOVE_ACCOUNT), 
													 BMessenger( this)));
				} else {
					// second step, do it if user said ok:
					if (buttonPressed == 0) {
						TheSmtpAccountList->RemoveItemFromList( mCurrAcc.Get());
						mCurrAcc = NULL;
						NoticeChange();
					}
				}
				break;
			}
			case BM_COMPLAIN_ABOUT_FIELD: {
				int32 buttonPressed;
				if (msg->FindInt32( "which", &buttonPressed) != B_OK) {
					BmString complaint;
					complaint = msg->FindString( MSG_COMPLAINT);
					// first step, tell user about complaint:
					BAlert* alert = new BAlert( "Sanity Check Failed", 
														 complaint.String(),
													 	 "OK", NULL, NULL, B_WIDTH_AS_USUAL,
													 	 B_WARNING_ALERT);
					alert->SetShortcut( 0, B_ESCAPE);
					alert->Go( new BInvoker( new BMessage(*msg), BMessenger( this)));
					BmSmtpAccount* acc=NULL;
					msg->FindPointer( MSG_ITEM, (void**)&acc);
					BmListViewItem* accItem = mAccListView->FindViewItemFor( acc);
					if (accItem)
						mAccListView->Select( mAccListView->IndexOf( accItem));
				} else {
					// second step, set corresponding focus:
					BmString fieldName;
					fieldName = msg->FindString( MSG_FIELD_NAME);
					if (fieldName.ICompare( "username")==0)
						mLoginControl->MakeFocus( true);
					else if (fieldName.ICompare( "smtpserver")==0)
						mServerControl->MakeFocus( true);
					else if (fieldName.ICompare( "pop-account")==0)
						mPopControl->MakeFocus( true);
					else if (fieldName.ICompare( "portnr")==0)
						mPortControl->MakeFocus( true);
				}
				break;
			}
			default:
				inherited::MessageReceived( msg);
		}
	}
	catch( BM_error &err) {
		// a problem occurred, we tell the user:
		BM_SHOWERR( BmString("PrefsView_") << Name() << ":\n\t" << err.what());
	}
}
예제 #3
0
/*------------------------------------------------------------------------------*\
	()
		-	
\*------------------------------------------------------------------------------*/
void BmPrefsSendMailView::UndoChanges() {
	TheSmtpAccountList->Cleanup();
	TheSmtpAccountList->StartJobInThisThread();
	ShowAccount( -1);
}
예제 #4
0
/*------------------------------------------------------------------------------*\
	()
		-	
\*------------------------------------------------------------------------------*/
void BmPrefsSendMailView::Initialize() {
	inherited::Initialize();

	TheBubbleHelper->SetHelp( 
		mAccListView, 
		"This listview shows every SMTP-account you have defined."
	);
	TheBubbleHelper->SetHelp( 
		mAccountControl, 
		"Here you can enter a name for this SMTP-account.\n"
		"This name is used to identify this account in Beam."
	);
	TheBubbleHelper->SetHelp( 
		mDomainControl, 
		"Some SMTP-Servers check the domain announced by the client\n"
		"at session-start. This check will fail if the domain of the client-pc\n"
		"differs from the real internet-domain (usually the case if\n"
		"the client-pc has no permanent connection to the internet).\n\n"
		"If the SMTP-server rejects connections, you should try to enter\n"
		"your dial-in-provider's domain into this field, otherwise leave\n"
		"the field empty."
	);
	TheBubbleHelper->SetHelp( 
		mLoginControl, 
		"Here you can enter the username which \n"
		"will be used during authentication."
	);
	TheBubbleHelper->SetHelp( 
		mPwdControl, 
		"Here you can enter the password which \n"
		"will be used during authentication.\n"
		"(You can only edit this field if you \n"
		"checked 'Store Password on Disk')."
	);
	TheBubbleHelper->SetHelp( 
		mClientCertControl, 
		TheNetEndpointRoster->SupportsEncryption() 
		?
		"Some servers require the user to authenticate\n"
		"with a PKCS#12-client-certificate (as part of the SSL/TLS-\n"
		"handshake). Here you can specify the file that contains\n"
		"the client certificate."
		:
		"Certificate support is not available,\n"
		"no addon could be loaded"
	);
	TheBubbleHelper->SetHelp( 
		mSelectClientCertButton, 
		TheNetEndpointRoster->SupportsEncryption() 
		?
		"Pressing this button allows you to select the\n"
		"PKCS#12-file that is going to be used as the client\n"
		"certificate in order to authenticate to the server."
		:
		"Certificate support is not available,\n"
		"no addon could be loaded"
	);
	TheBubbleHelper->SetHelp( 
		mStorePwdControl, 
		"Checking this allows Beam to store the given \n"
		"password unsafely on disk.\n"
		"If you uncheck this, Beam will ask you for the password\n"
		"everytime you use this account."
	);
	TheBubbleHelper->SetHelp( 
		mServerControl, 
		"Please enter the full name of the SMTP-server \n"
		"into this field (e.g. 'mail.xxx.org')."
	);
	TheBubbleHelper->SetHelp( 
		mPortControl, 
		"Please enter the SMTP-port of the server \n"
		"into this field (usually 25)."
	);
	static BmString encrHelp;
	if (TheNetEndpointRoster->SupportsEncryption()) {
		encrHelp 
			= 		"Here you can select the type of encryption to use:\n"
					"<none>	- no encryption.";
		if (TheNetEndpointRoster->SupportsEncryptionType(BmSmtpAccount::ENCR_TLS))
			encrHelp 
				<< "\n"
				<<	"<auto>		- means the STARTTLS method will be used if available.\n"
					"STARTTLS	- TLS (Transport Layer Security) encryption on\n"
					"		  the standard SMTP-port (usually 25).\n"
					"TLS		- TLS (Transport Layer Security) encryption on\n"
					"		  a special SMTPS-port (usually 465).";
		if (TheNetEndpointRoster->SupportsEncryptionType(BmSmtpAccount::ENCR_SSL))
			encrHelp 
				<< "\n"
				<< "SSL		- SSL (Secure Socket Layer) encryption on\n"
					"		  a special SMTPS-port (usually 465).";
	} else {
		encrHelp = "Encryption is not available,\n"
					  "no addon could be loaded";
	}
	TheBubbleHelper->SetHelp( 
		mEncryptionControl, encrHelp.String()
	);
	TheBubbleHelper->SetHelp( 
		mAuthControl, 
		"Here you can select the authentication type to use:\n"
		"<auto>		- means the best (safest) available mode is used automatically.\n"
		"DIGEST-MD5	- is safe, neither password nor user are sent in cleartext.\n"
		"CRAM-MD5		- is safe, neither password nor user are sent in cleartext.\n"
		"PLAIN		- is a simple auth-mode which sends passwords in cleartext\n"
		"LOGIN		- is another simple auth-mode that sends passwords in cleartext\n"
		"SMTP-AFTER-POP	- does SMTP-authentication via the use of a POP3-server.\n"
		"<none> 		- is the simplest mode, no authentication at all."
	);
	TheBubbleHelper->SetHelp( 
		mPopControl, 
		"Here you can select the POP3-account that shall be used\n"
		"when authenticating via SMTP-AFTER-POP."
	);
	TheBubbleHelper->SetHelp( 
		mCheckAndSuggestButton, 
		"When you click here, Beam will connect to the SMTP-server,\n"
		"check which authentication types it supports and select\n"
		"the most secure."
	);
	TheBubbleHelper->SetHelp( 
		mAcceptedCertControl, 
		"This shows the MD5-fingerprint of the server certificate\n"
		"which has been permanently accepted in one of the preceeding\n"
		"sessions."
	);
	TheBubbleHelper->SetHelp( 
		mClearAcceptedCertButton, 
		"Pressing this button resets the certificate information for\n"
		"this account, such that Beam no longer accepts the server's\n"
		"certificate automatically."
	);

	mAccountControl->SetTarget( this);
	mDomainControl->SetTarget( this);
	mLoginControl->SetTarget( this);
	mPortControl->SetTarget( this);
	mPwdControl->SetTarget( this);
	mServerControl->SetTarget( this);
	mStorePwdControl->SetTarget( this);

	AddItemToMenu( mEncryptionControl->Menu(), 
						new BMenuItem( BM_NoItemLabel.String(), 
											new BMessage(BM_ENCRYPTION_SELECTED)), 
						this);
	if (TheNetEndpointRoster->SupportsEncryptionType(BmSmtpAccount::ENCR_TLS)) {
		AddItemToMenu( mEncryptionControl->Menu(), 
							new BMenuItem( BmSmtpAccount::ENCR_AUTO, 
												new BMessage(BM_ENCRYPTION_SELECTED)), 
							this);
		AddItemToMenu( mEncryptionControl->Menu(), 
							new BMenuItem( BmSmtpAccount::ENCR_STARTTLS, 
												new BMessage(BM_ENCRYPTION_SELECTED)), 
							this);
		AddItemToMenu( mEncryptionControl->Menu(), 
							new BMenuItem( BmSmtpAccount::ENCR_TLS, 
												new BMessage(BM_ENCRYPTION_SELECTED)), 
							this);
	}
	if (TheNetEndpointRoster->SupportsEncryptionType(BmSmtpAccount::ENCR_SSL)) {
		AddItemToMenu( mEncryptionControl->Menu(), 
							new BMenuItem( BmSmtpAccount::ENCR_SSL, 
												new BMessage(BM_ENCRYPTION_SELECTED)), 
							this);
	}

	mAccListView->SetSelectionMessage( new BMessage( BM_SELECTION_CHANGED));
	mAccListView->SetTarget( this);
	mAccListView->StartJob( TheSmtpAccountList.Get());
	ShowAccount( -1);
}
예제 #5
0
// This only does something the first time you run it.
//
void MTDetailEdit::FirstRun(MTDetailEdit::DetailEditType theType)
{
    if (m_bFirstRun)
    {
        // -------------------------------------------
        ui->comboBox->setHidden(true);
        // -------------------------------------------
        ui->tableWidget->setColumnCount(2);
        ui->tableWidget->setSelectionMode    (QAbstractItemView::SingleSelection);
        ui->tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
        // -------------------------------------------
        ui->tableWidget->horizontalHeader()->resizeSection(0, 5);
        // -------------------------------------------
        ui->tableWidget->horizontalHeader()->setStretchLastSection(true);
        ui->tableWidget->verticalHeader()->setDefaultSectionSize(60);
        ui->tableWidget->verticalHeader()->hide();
        ui->tableWidget->horizontalHeader()->hide();
        // -------------------------------------------
        ui->tableWidget->setContentsMargins(10,0,0,0);
        // -------------------------------------------
        ui->tableWidget->setSizePolicy(
                    QSizePolicy::Expanding,
                    QSizePolicy::Expanding);
        // ----------------------------------
        m_pTabWidget  = new QTabWidget;
        // ----------------------------------
        m_pTabWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
        m_pTabWidget->setContentsMargins(5, 5, 5, 5);
        // ----------------------------------
        QWidget * pTab1 = new QWidget;
        // ----------------------------------
        pTab1->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
        pTab1->setContentsMargins(5, 5, 5, 5);
        // ----------------------------------
        QString qstrTab1Title = tr("Details");

        m_pTabWidget->addTab(pTab1, qstrTab1Title);
        // -------------------------------------------
        // Instantiate m_pDetailPane to one of various types.
        //
        m_Type = theType;

        switch (m_Type)
        {
        case MTDetailEdit::DetailEditTypeServer:
            m_pDetailPane = new MTServerDetails(this, *this);
            // -------------------------------------------
            connect(m_pDetailPane,      SIGNAL(newServerAdded(QString)),
                    Moneychanger::It(), SLOT  (onNewServerAdded(QString)));
            // -------------------------------------------
            connect(m_pDetailPane,      SIGNAL(newServerAdded(QString)),
                    m_pDetailPane,      SIGNAL(RefreshRecordsAndUpdateMenu()));
            // -------------------------------------------
            break;

        case MTDetailEdit::DetailEditTypeAsset:
            m_pDetailPane = new MTAssetDetails(this, *this);
            // -------------------------------------------
            connect(m_pDetailPane,      SIGNAL(newAssetAdded(QString)),
                    Moneychanger::It(), SLOT  (onNewAssetAdded(QString)));
            // -------------------------------------------
            connect(m_pDetailPane,      SIGNAL(newAssetAdded(QString)),
                    m_pDetailPane,      SIGNAL(RefreshRecordsAndUpdateMenu()));
            // -------------------------------------------

            // For new issuer accounts: (which are created on the assets page when a user registers the currency onto a server.)
            // -------------------------------------------
            connect(m_pDetailPane,      SIGNAL(newAccountAdded(QString)),
                    Moneychanger::It(), SLOT  (onNewAccountAdded(QString)));
            // -------------------------------------------
            connect(m_pDetailPane,      SIGNAL(newAccountAdded(QString)),
                    m_pDetailPane,      SIGNAL(RefreshRecordsAndUpdateMenu()));
            // -------------------------------------------
            connect(m_pDetailPane,      SIGNAL(newAccountAdded(QString)),
                    m_pDetailPane,      SIGNAL(ShowAccount(QString)));
            // -------------------------------------------
            break;

        case MTDetailEdit::DetailEditTypeNym:
            m_pDetailPane = new MTNymDetails(this, *this);
            // -------------------------------------------
            connect(m_pDetailPane,      SIGNAL(newNymAdded(QString)),
                    Moneychanger::It(), SLOT  (onNewNymAdded(QString)));
            // -------------------------------------------
            connect(m_pDetailPane,      SIGNAL(newNymAdded(QString)),
                    m_pDetailPane,      SIGNAL(RefreshRecordsAndUpdateMenu()));
            // -------------------------------------------
            break;

        case MTDetailEdit::DetailEditTypeContact:     m_pDetailPane = new MTContactDetails    (this, *this); break;
        case MTDetailEdit::DetailEditTypeCorporation: m_pDetailPane = new MTCorporationDetails(this, *this); break;
        case MTDetailEdit::DetailEditTypeTransport:   m_pDetailPane = new TransportDetails    (this, *this); break;

        case MTDetailEdit::DetailEditTypeAgreement:
            ui->comboBox->setHidden(false);
            m_pDetailPane = new MTAgreementDetails  (this, *this);
            // -------------------------------------------
            connect(ui->comboBox, SIGNAL(currentIndexChanged(int)),
                    this,         SLOT  (on_comboBox_currentIndexChanged(int)));
            // -------------------------------------------
            connect(m_pDetailPane,      SIGNAL(runSmartContract(QString, QString, int32_t)),
                    Moneychanger::It(), SLOT  (onRunSmartContract(QString, QString, int32_t)));
            // -------------------------------------------
            break;

        case MTDetailEdit::DetailEditTypeOffer:
            ui->comboBox->setHidden(false);
            m_pDetailPane = new MTOfferDetails(this, *this);
            // -------------------------------------------
            connect(ui->comboBox, SIGNAL(currentIndexChanged(int)),
                    this,         SLOT  (on_comboBox_currentIndexChanged(int)));
            // -------------------------------------------
            break;
        case MTDetailEdit::DetailEditTypeMarket:
            EnableAdd   (false);
            EnableDelete(false);
            m_pDetailPane = new MTMarketDetails(this, *this);
            break;

        case MTDetailEdit::DetailEditTypeAccount:
            m_pDetailPane = new MTAccountDetails(this, *this);
            // -------------------------------------------
            connect(m_pDetailPane,      SIGNAL(DefaultAccountChanged(QString, QString)),
                    Moneychanger::It(), SLOT  (setDefaultAccount(QString, QString)));
            // -------------------------------------------
            connect(m_pDetailPane,      SIGNAL(SendFromAcct(QString)),
                    Moneychanger::It(), SLOT  (mc_send_from_acct(QString)));
            // -------------------------------------------
            connect(m_pDetailPane,      SIGNAL(RequestToAcct(QString)),
                    Moneychanger::It(), SLOT  (mc_request_to_acct(QString)));
            // -------------------------------------------
            connect(m_pDetailPane,      SIGNAL(newAccountAdded(QString)),
                    Moneychanger::It(), SLOT  (onNewAccountAdded(QString)));
            // -------------------------------------------
            connect(m_pDetailPane,      SIGNAL(newAccountAdded(QString)),
                    m_pDetailPane,      SIGNAL(RefreshRecordsAndUpdateMenu()));
            // -------------------------------------------
            break;

        default:
            qDebug() << "MTDetailEdit::dialog: MTDetailEdit::DetailEditTypeError";
            return;
        } //switch
        // -------------------------------------------
        connect(m_pDetailPane,      SIGNAL(NeedToUpdateMenu()),
                Moneychanger::It(), SLOT  (onNeedToUpdateMenu()));
        // -------------------------------------------
        connect(m_pDetailPane,      SIGNAL(RefreshRecordsAndUpdateMenu()),
                Moneychanger::It(), SLOT  (onNeedToUpdateMenu()));
        // -------------------------------------------
        connect(m_pDetailPane,      SIGNAL(RefreshRecordsAndUpdateMenu()),
                this,               SLOT  (onRefreshRecords()));
        // -------------------------------------------
        connect(m_pDetailPane,      SIGNAL(ShowAsset(QString)),
                Moneychanger::It(), SLOT  (mc_show_asset_slot(QString)));
        // -------------------------------------------
        connect(m_pDetailPane,      SIGNAL(ShowNym(QString)),
                Moneychanger::It(), SLOT  (mc_show_nym_slot(QString)));
        // -------------------------------------------
        connect(m_pDetailPane,      SIGNAL(ShowServer(QString)),
                Moneychanger::It(), SLOT  (mc_show_server_slot(QString)));
        // -------------------------------------------
        connect(m_pDetailPane,      SIGNAL(ShowAccount(QString)),
                Moneychanger::It(), SLOT  (mc_show_account_slot(QString)));
        // -------------------------------------------

        m_pDetailPane->SetOwnerPointer(*this);
        m_pDetailPane->SetEditType(theType);
        // -------------------------------------------
        m_pDetailLayout = new QVBoxLayout;
        m_pDetailLayout->addWidget(m_pDetailPane);

        m_pDetailPane  ->setContentsMargins(1,1,1,1);
        m_pDetailLayout->setContentsMargins(1,1,1,1);
        // ----------------------------------

        pTab1->setLayout(m_pDetailLayout);

        // ----------------------------------
        int nCustomTabCount = m_pDetailPane->GetCustomTabCount();

        if (nCustomTabCount > 0)
        {
            for (int ii = 0; ii < nCustomTabCount; ii++)
            {
                QWidget * pTab = m_pDetailPane->CreateCustomTab(ii);
                // ----------------------------------
                if (NULL != pTab)
                {
                    pTab->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
                    pTab->setContentsMargins(5, 5, 5, 5);

                    QString qstrTabName = m_pDetailPane->GetCustomTabName(ii);

                    m_pTabWidget->addTab(pTab, qstrTabName);
                }
                // ----------------------------------
            }
        }
        // -----------------------------------------------
        QGridLayout * pGridLayout = new QGridLayout;
        pGridLayout->addWidget(m_pTabWidget);

        pGridLayout->setContentsMargins(0,0,0,0);
        m_pTabWidget->setTabPosition(QTabWidget::South);
        // ----------------------------------
        ui->widget->setContentsMargins(1,1,1,1);
        // ----------------------------------
        ui->widget->setLayout(pGridLayout);
        // ----------------------------------
        if (!m_bEnableAdd)
            ui->addButton->setVisible(false);
        // ----------------------------------
        if (!m_bEnableDelete)
            ui->deleteButton->setVisible(false);
        // ----------------------------------
        if (m_pDetailPane)
            m_pDetailPane->setVisible(false);

        m_pTabWidget->setVisible(false);
        // ----------------------------------
        m_bFirstRun = false;
    } // first run.
}
예제 #6
0
void MTSendDlg::on_toolButtonManageAccts_clicked()
{
    emit ShowAccount(m_myAcctId);
}