예제 #1
0
void TabbableWidget::bringToFront()
{
	if (isTabbed()) {
		getManagingTabDlg()->selectTab(this);
	}
	::bringToFront(this);
}
예제 #2
0
void TabbableWidget::bringToFront(bool raiseWindow)
{
	if (isTabbed()) {
		getManagingTabDlg()->selectTab(this);
	}
	if (raiseWindow) {
		::bringToFront(this);
	}
}
예제 #3
0
/**
 * Returns true if this tab is active in the active window.
 */
bool TabbableWidget::isActiveTab()
{
	if (isHidden()) {
		return false;
	}
	if (!isTabbed()) {
		return isActiveWindow() && !isMinimized();
	}
	return getManagingTabDlg()->isActiveWindow() &&
	       getManagingTabDlg()->tabOnTop(this) &&
	      !getManagingTabDlg()->isMinimized();
}
예제 #4
0
파일: chatdlg.cpp 프로젝트: hummbl/psi
void ChatDlg::setShortcuts()
{
	act_send_->setShortcuts(ShortcutManager::instance()->shortcuts("chat.send"));
	act_scrollup_->setShortcuts(ShortcutManager::instance()->shortcuts("common.scroll-up"));
	act_scrolldown_->setShortcuts(ShortcutManager::instance()->shortcuts("common.scroll-down"));

	if(!isTabbed()) {
		act_close_->setShortcuts(ShortcutManager::instance()->shortcuts("common.close"));
	} else {
		act_close_->QAction::setShortcuts (QList<QKeySequence>());
	}
}
예제 #5
0
void TabbableWidget::ensureTabbedCorrectly()
{
	if (tabManager_->shouldBeTabbed(this)) {
		if (!isTabbed()) {
			tabManager_->getTabs(this)->addTab(this);
		}
	}
	else {
		if (PsiOptions::instance()->getOption("options.ui.tabs.tab-singles").toString().contains(tabManager_->tabKind(this))) {
			if (isTabbed()) {
				if (getManagingTabDlg()->tabCount() > 1) {
					getManagingTabDlg()->closeTab(this, false);
					tabManager_->newTabs(this)->addTab(this);
				}
			}
			else {
				tabManager_->newTabs(this)->addTab(this);
			}
		}
		else {
			if (isTabbed()) {
				getManagingTabDlg()->closeTab(this, false);
			}

			// FIXME: showWithoutActivation() works on all
			//   platforms, but bringToFront() (which might be
			//   called immediately after) does not work on all
			//   platforms if it follows a call to
			//   showWithoutActivation().  As a temporary fix, we
			//   will only call showWithoutActivation() on
			//   platforms where both calls can be made in
			//   succession.
#ifdef Q_WS_WIN
			showWithoutActivation();
#else
			show();
#endif
		}
	}
}
예제 #6
0
void TabbableWidget::ensureTabbedCorrectly()
{
	if (tabManager_->shouldBeTabbed(this)) {
		if (!isTabbed()) {
			tabManager_->getTabs(this)->addTab(this);
		}
	} else {
		if(PsiOptions::instance()->getOption("options.ui.tabs.tab-singles").toString().contains(tabManager_->tabKind(this))) {
			if (isTabbed()) {
				if(getManagingTabDlg()->tabCount() > 1) {
					getManagingTabDlg()->closeTab(this, false);
					tabManager_->newTabs(this)->addTab(this);
				}
			}
			else
				tabManager_->newTabs(this)->addTab(this);
		} else {
			if (isTabbed()) {
				getManagingTabDlg()->closeTab(this, false);
				show();
			}
		}
	}
}
예제 #7
0
TabbableWidget::~TabbableWidget()
{
	if (isTabbed()) {
		getManagingTabDlg()->removeTabWithNoChecks(this);
	}
}
예제 #8
0
파일: chatdlg.cpp 프로젝트: hummbl/psi
void ChatDlg::appendMessage(const Message &m, bool local)
{
	// figure out the encryption state
	bool encChanged = false;
	bool encEnabled = false;
	if (lastWasEncrypted_ != m.wasEncrypted()) {
		encChanged = true;
	}
	lastWasEncrypted_ = m.wasEncrypted();
	encEnabled = lastWasEncrypted_;

	if (encChanged) {
		if (encEnabled) {
			appendSysMsg(QString("<icon name=\"psi/cryptoYes\"> ") + tr("Encryption Enabled"));
			if (!local) {
				setPGPEnabled(true);
			}
		}
		else {
			appendSysMsg(QString("<icon name=\"psi/cryptoNo\"> ") + tr("Encryption Disabled"));
			if (!local) {
				setPGPEnabled(false);

				// enable warning
				warnSend_ = true;
				QTimer::singleShot(3000, this, SLOT(setWarnSendFalse()));
			}
		}
	}

	QString txt = messageText(m);

	ChatDlg::SpooledType spooledType = m.spooled() ?
	                                   ChatDlg::Spooled_OfflineStorage :
	                                   ChatDlg::Spooled_None;
	if (isEmoteMessage(m))
		appendEmoteMessage(spooledType, m.timeStamp(), local, txt);
	else
		appendNormalMessage(spooledType, m.timeStamp(), local, txt);

	appendMessageFields(m);

	if (local) {
		deferredScroll();
	}

	// if we're not active, notify the user by changing the title
	if (!isActiveTab()) {
		++pending_;
		invalidateTab();
		if (PsiOptions::instance()->getOption("options.ui.flash-windows").toBool()) {
			doFlash(true);
		}
		if (PsiOptions::instance()->getOption("options.ui.chat.raise-chat-windows-on-new-messages").toBool()) {
			if (isTabbed()) {
				TabDlg* tabSet = getManagingTabDlg();
				tabSet->selectTab(this);
				::bringToFront(tabSet, false);
			}
			else {
				::bringToFront(this, false);
			}
		}
	}
	//else {
	//	messagesRead(jid());
	//}

	if (!local) {
		keepOpen_ = true;
		QTimer::singleShot(1000, this, SLOT(setKeepOpenFalse()));
	}
}