示例#1
0
void PopupEditorWidget::customContextMenuRequested(const QPoint & pos)
{
	QTreeWidgetItem * it = m_pTreeWidget->itemAt(pos);
	KVI_ASSERT(m_bOneTimeSetupDone);

	if(it)
	{
		m_pContextPopup->clear();

		m_pContextPopup->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::Popup)),
		    __tr2qs_ctx("&New Popup", "editor"), this, SLOT(newPopup()));

		m_pContextPopup->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::Discard)),
		    __tr2qs_ctx("Re&move Popup", "editor"), this, SLOT(removeCurrentPopup()))
		    ->setEnabled(it);

		m_pContextPopup->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::Save)),
		    __tr2qs_ctx("&Export Popup to...", "editor"), this, SLOT(exportCurrentPopup()))
		    ->setEnabled(it);

		m_pContextPopup->popup(QCursor::pos());
	}
	else
	{
		m_pEmptyContextPopup->clear();

		m_pEmptyContextPopup->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::Popup)),
		    __tr2qs_ctx("&New Popup", "editor"), this, SLOT(newPopup()));
		m_pEmptyContextPopup->popup(QCursor::pos());
	}
}
/*!
 * Display the new profile in the tabbed area
 * and show a message with the systray icon
 */
void CustomerInfoPanel::showNewProfile(Popup * popup)
{
    QString opt = "";
    qDebug() << Q_FUNC_INFO << popup->callWhere()
             << popup->callIpbxId() << popup->callChannel();
    if(popup->sheetpopup()) {
        // removed the "already_popup" stuff, since it is already handled in displayFiche()
        QString currentTimeStr = QDateTime::currentDateTime().toString("hh:mm:ss");
        quint32 index = m_tabs->addTab(popup, currentTimeStr);
        qDebug() << Q_FUNC_INFO << "added tab" << index;
        m_tabs->setCurrentIndex(index);
        if (index >= m_tablimit)
            // close the first widget
            m_tabs->removeTab(0);

        // no need to focus if there is no sheet popup
        if(popup->focus())
            opt += "fp";
    }

    // tells the main widget that a new popup has arrived here
    if(popup->systraypopup())
        opt += "s";
    emit newPopup(popup->messagetitle(), popup->message(), opt);
    // set this widget to be the current tab in XiVO Client
    emit showWidgetOnTop(this);
}
/**
 * setup menu, shortcuts, create GUI
 */
void KLinPopup::setupActions()
{
	KStdAction::quit(this, SLOT(slotQuit()), actionCollection());

	setStandardToolBarMenuEnabled(true);
	createStandardStatusBarAction();

	m_menubarAction = KStdAction::showMenubar(this, SLOT(optionsShowMenubar()), actionCollection());

	KStdAction::keyBindings(this, SLOT(optionsConfigureKeys()), actionCollection());
	KStdAction::configureToolbars(this, SLOT(optionsConfigureToolbars()), actionCollection());
	KStdAction::preferences(this, SLOT(optionsPreferences()), actionCollection());

	newPopupAction = new KAction(i18n("&New"),
								 "mail_new", CTRL+Key_N,
								 this, SLOT(newPopup()),
								 actionCollection(), "new_popup");
	replyPopupAction = new KAction(i18n("&Reply"),
								   "mail_reply", CTRL+Key_R,
								   this, SLOT(replyPopup()),
								   actionCollection(), "reply_popup");
	firstPopupAction = new KAction(i18n("&First"),
								   "start", CTRL+Key_B,
								   this, SLOT(firstPopup()),
								   actionCollection(), "first_popup");
	prevPopupAction = new KAction(i18n("&Previous"),
								  "back", CTRL+Key_P,
								  this, SLOT(prevPopup()),
								  actionCollection(), "previous_popup");
	nextPopupAction = new KAction(i18n("&Next"),
								  "forward", CTRL+Key_F,
								  this, SLOT(nextPopup()),
								  actionCollection(), "next_popup");
	lastPopupAction = new KAction(i18n("&Last"),
								  "finish", CTRL+Key_L,
								  this, SLOT(lastPopup()),
								  actionCollection(), "last_popup");
	unreadPopupAction = new KAction(i18n("&Unread"),
									"new_popup", CTRL+Key_U,
									this, SLOT(unreadPopup()),
									actionCollection(), "unread_popup");
	deletePopupAction = new KAction(i18n("&Delete"),
									"mail_delete", CTRL+Key_D,
									this, SLOT(deletePopup()),
									actionCollection(), "delete_popup");
	createGUI();
}