コード例 #1
0
void MessageWidget::connectAction(enumActionType actionType, QAction *action)
{
	switch (actionType) {
	case ACTION_REMOVE:
		connect(action, SIGNAL(triggered()), this, SLOT(remove()));
		break;
	case ACTION_REPLY:
		connect(action, SIGNAL(triggered()), this, SLOT(reply()));
		break;
	case ACTION_REPLY_ALL:
		connect(action, SIGNAL(triggered()), this, SLOT(replyAll()));
		break;
	case ACTION_FORWARD:
		connect(action, SIGNAL(triggered()), this, SLOT(forward()));
		break;
	case ACTION_PRINT:
		connect(action, SIGNAL(triggered()), this, SLOT(print()));
		break;
	case ACTION_PRINT_PREVIEW:
		connect(action, SIGNAL(triggered()), this, SLOT(printPreview()));
		break;
	case ACTION_SAVE_AS:
		connect(action, SIGNAL(triggered()), this, SLOT(saveAs()));
		break;
	}
}
コード例 #2
0
ファイル: readmail.cpp プロジェクト: opieproject/opie
void ReadMail::init()
{
	setToolBarsMovable(FALSE);

	QPopupMenu* mailaction=new QPopupMenu(this);

	bar = new QToolBar(this);
	bar->setHorizontalStretchable( TRUE );

	menu = new QMenuBar( bar );

	viewMenu = new QPopupMenu(menu);
	menu->insertItem( tr( "&View" ), viewMenu);

	mailMenu = new QPopupMenu(menu);
	menu->insertItem( tr( "&Mail" ), mailMenu);

	bar = new QToolBar(this);

	downloadButton = new QAction( tr( "Download" ), Resource::loadPixmap( "mailit/download" ),QString::null, 0, this, 0 );
	connect(downloadButton, SIGNAL(activated()), this, SLOT(download()) );
  	downloadButton->setWhatsThis(tr("Click here to download the selected mail"));


	previousButton = new QAction( tr( "Previous" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 );
	connect( previousButton, SIGNAL( activated() ), this, SLOT( previous() ) );
	previousButton->addTo(bar);
	previousButton->addTo(viewMenu);
	previousButton->setWhatsThis(tr("Read the previous mail in the list"));

	nextButton = new QAction( tr( "Next" ), Resource::loadPixmap( "forward" ), QString::null, 0, this, 0 );
	connect( nextButton, SIGNAL( activated() ), this, SLOT( next() ) );
	nextButton->addTo(bar);
	nextButton->addTo(viewMenu);
	previousButton->setWhatsThis(tr("Read the next mail in the list"));

	attachmentButton = new QAction( tr( "Attatchments" ), Resource::loadPixmap( "mailit/attach" ), QString::null, 0, this, 0 );
	connect( attachmentButton, SIGNAL( activated() ), this,
		SLOT( viewAttachments() ) );
	attachmentButton->addTo(bar);
	attachmentButton->addTo(viewMenu);
	attachmentButton->setWhatsThis(tr("Click here to add attachments to your mail"));

	plainTextButton = new QAction( tr( "Text Format" ), Resource::loadPixmap( "DocsIcon" ), QString::null, 0, this, 0, TRUE);
	connect( plainTextButton, SIGNAL( activated() ), this, SLOT( shiftText() ) );
	plainTextButton->addTo(bar);
	plainTextButton->addTo(viewMenu);
	plainTextButton->setWhatsThis(tr("The mail view has 2 modes:\n"
	"<LI><B>RichText</B> shows the mail as HTML with reach features (no standard line breaks)</LI>"
	"<LI><B>Plain</B> shows the mail as standard plain text</LI>"
	"Click here to switch between those view modes" ));

    	//reply dependant on viewing inbox
	replyButton = new QToolButton(Resource::loadPixmap("mailit/reply"),tr("reply"),tr("reply to mail"), this,SLOT(reply()),bar);
        QWhatsThis::add(replyButton,tr("Click here to reply to the selected mail\nPress and hold for more options."));
	replyButton->setPopup(mailaction);

	replyAllButton = new QAction( tr( "Reply all" ), Resource::loadPixmap( "mailit/reply" ),QString::null, 0, this, 0 );
	connect(replyAllButton, SIGNAL(activated()), this, SLOT(replyAll()));
	replyAllButton->setWhatsThis(tr("Click here to reply to the selected mail to CC: addresses also"));
	replyAllButton->addTo(mailaction);

	forwardButton = new QAction( tr( "Forward" ), Resource::loadPixmap( "mailit/forward" ),
	QString::null, 0, this, 0 );
	connect(forwardButton, SIGNAL(activated()), this, SLOT(forward()));
	forwardButton->setWhatsThis(tr("Click here to forward the selected mail"));
	forwardButton->addTo(mailaction);


	deleteButton = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 );
	connect( deleteButton, SIGNAL( activated() ), this, SLOT( deleteItem() ) );
	deleteButton->addTo(bar);
	deleteButton->addTo(mailMenu);
	deleteButton->setWhatsThis(tr("Click here to remove the selected mail"));

	viewMenu->insertItem(Resource::loadPixmap("close"), "Close", this, SLOT(close()));

	emailView = new QTextView( this, "emailView" );

	setCentralWidget(emailView);

	mime = new QMimeSourceFactory();
	emailView->setMimeSourceFactory(mime);
}