void ChatWindow::closeTab()
{
	QString tooltip=ui->tab->tabToolTip(ui->tab->currentIndex());
	QString txt=ui->tab->tabText(ui->tab->currentIndex());

	if(txt==tooltip)
	{
		QMapIterator<QString, QTextEdit*> i(serveurs[tooltip]->conversations);

		int count=ui->tab->currentIndex()+1;

		while(i.hasNext())
		{
			i.next();
			ui->tab->removeTab(count);
		}

		currentTab()->abort();
		ui->tab->removeTab(ui->tab->currentIndex());
	}
	else
	{

        ui->tab->removeTab(ui->tab->currentIndex());
		currentTab()->conversations.remove(txt);
	}
}
示例#2
0
QString MainWindow::selectedText() const
{
    if (!currentTab())
        return QString();

    return currentTab()->view()->selectedText();
}
示例#3
0
void MainWindow::openPrevious(Qt::MouseButtons mouseButtons, Qt::KeyboardModifiers keyboardModifiers)
{
    QWebHistory *history = currentTab()->view()->history();
    QWebHistoryItem *item = 0;

    if (currentTab()->page()->isOnRekonqPage())
    {
        item = new QWebHistoryItem(history->currentItem());
    }
    else
    {
        if (history->canGoBack())
        {
            item = new QWebHistoryItem(history->backItem());
        }
    }

    if(!item)
        return;

    if (mouseButtons == Qt::MidButton || keyboardModifiers == Qt::ControlModifier)
    {
        Application::instance()->loadUrl(item->url(), Rekonq::NewTab);
    }
    else
    {
        history->goToItem(*item);
    }

    updateActions();
}
示例#4
0
void ExtendedDialog::saveConfig()
{
    assert( currentTab() == AUDIO_TAB || currentTab() == VIDEO_TAB );
    QHash<QString, QVariant> *hashConfig = &m_hashConfigs[currentTab()];

    for( QHash<QString, QVariant>::iterator i = hashConfig->begin();
         i != hashConfig->end(); ++i )
    {
        QVariant &value = i.value();
        switch( static_cast<QMetaType::Type>(value.type()) )
        {
            case QMetaType::QString:
                config_PutPsz( p_intf, qtu(i.key()), qtu(value.toString()) );
                break;
            case QMetaType::Int:
                config_PutInt( p_intf, qtu(i.key()), value.toInt() ) ;
                break;
            case QMetaType::Double:
            case QMetaType::Float:
                config_PutFloat( p_intf, qtu(i.key()), value.toFloat() ) ;
                break;
            default:
                vlc_assert_unreachable();
        }
    }
    config_SaveConfigFile( p_intf );
    hashConfig->clear();
    m_applyButton->setEnabled( false );
}
示例#5
0
void MainWindow::viewPageSource()
{
    if (!currentTab())
        return;

    KUrl url = currentTab()->url();
    KRun::runUrl(url, QL1S("text/plain"), this, false);
}
示例#6
0
void MainWindow::search()
{
  if(currentTab() && currentTab()->textEdit())
  {
    searchDialog->setEditor(currentTab()->textEdit());
    searchDialog->show();
  }
}
示例#7
0
void MainWindow::switchToNextTab()
{
    if (currentTab() != (tabs.size() - 1)) {
        ui->tabWidget->setCurrentIndex(currentTab() + 1);
    }else {
        ui->tabWidget->setCurrentIndex(0);
    }
}
示例#8
0
void MainWindow::matchCaseUpdate()
{
    if (!currentTab())
        return;

    currentTab()->view()->findText(m_lastSearch, QWebPage::FindBackward);
    findNext();
    updateHighlight();
}
示例#9
0
void MainWindow::switchToPrevTab()
{
    if (currentTab() != 0) {
        ui->tabWidget->setCurrentIndex(currentTab() - 1);
    }
    else {
        ui->tabWidget->setCurrentIndex(tabs.size() - 1);
    }
}
示例#10
0
void MainWindow::print()
{
  if(currentTab()->availableActions() && AbstractTabWidget::Print)
  {
    QPrinter *printer = currentTab()->printer();
    QPrintDialog *printDialog = new QPrintDialog(printer, this);
    if(printDialog->exec() == QDialog::Accepted)
      currentTab()->print();
  }
}
示例#11
0
void ChatWindow::sendCommand() {
    QString tooltip = ui->tab->tabToolTip(ui->tab->currentIndex());
    QString txt = ui->tab->tabText(ui->tab->currentIndex());
    if (txt == tooltip) {
        currentTab()->sendData(currentTab()->parseCommand(ui->lineEdit->text(), true));
    } else {
        currentTab()->sendData(currentTab()->parseCommand(ui->lineEdit->text()));
    }
    ui->lineEdit->clear();
    ui->lineEdit->setFocus();
}
示例#12
0
void YaTabBarBase::updateSendButton()
{
#ifndef WIDGET_PLUGIN
	// hack in order to get YaChatSendButtonExtra into correct position
	if (currentTab()) {
		YaChatSendButton* sendButton = currentTab()->findChild<YaChatSendButton*>();
		if (sendButton) {
			sendButton->updatePosition();
		}
	}
#endif
}
示例#13
0
void MainWindow::findPrevious()
{
    if (!currentTab())
        return;

    QWebPage::FindFlags options = QWebPage::FindBackward | QWebPage::FindWrapsAroundDocument;
    if (m_findBar->matchCase())
        options |= QWebPage::FindCaseSensitively;

    bool found = currentTab()->view()->findText(m_lastSearch, options);
    m_findBar->notifyMatch(found);
}
void ConnectionViewWidget::resetItemViews()
{
    if (currentTab() == ConnectionTab) {
        ui->connectionView->selectionModel()->clear();

    } else if (currentTab() == BindingTab) {
        ui->bindingView->selectionModel()->clear();

    } else if (currentTab() == DynamicPropertiesTab) {
        ui->dynamicPropertiesView->selectionModel()->clear();
    }
    invalidateButtonStatus();
}
示例#15
0
void MainWindow::updateActions()
{
    kDebug() << "updating actions..";
    bool rekonqPage = currentTab()->page()->isOnRekonqPage();

    QAction *historyBackAction = actionByName(KStandardAction::name(KStandardAction::Back));
    if( rekonqPage && currentTab()->view()->history()->count() > 0 )
        historyBackAction->setEnabled(true);
    else
        historyBackAction->setEnabled(currentTab()->view()->history()->canGoBack());

    QAction *historyForwardAction = actionByName(KStandardAction::name(KStandardAction::Forward));
    historyForwardAction->setEnabled(currentTab()->view()->history()->canGoForward());
}
示例#16
0
void MainWindow::saveFile()
{
    QFile file(tabs[currentTab()].path);
    if (file.open(QIODevice::WriteOnly|QIODevice::Text)) {
        file.write(ui->textEdit->toPlainText().toUtf8());
    }
}
示例#17
0
文件: sidebar.cpp 项目: fagu/kileip
void SideBar::shrink()
{
	KILE_DEBUG();
	if(isMinimized()) {
		return;
	}

	int currentIndex = currentTab(); // before changing m_minimized!
	m_tabStack->setVisible(false);
	m_minimized = true;

	if(m_orientation == Qt::Horizontal) {
		m_directionalSize = height();
		setFixedHeight(m_tabBar->sizeHint().height());
	}
	else if(m_orientation == Qt::Vertical) {
		m_directionalSize = width();
		setFixedWidth(m_tabBar->sizeHint().width());
	}

	// deselect the currect tab
	m_tabBar->setTab(currentIndex, false);

	emit visibilityChanged(false);
}
示例#18
0
void MainWindow::keyPressEvent(QKeyEvent *event)
{
    // hide findbar
    if (event->key() == Qt::Key_Escape)
    {
        m_findBar->hide();
        currentTab()->setFocus();   // give focus to web pages
        return;
    }

    // ctrl + tab action
    if ((event->modifiers() == Qt::ControlModifier) && (event->key() == Qt::Key_Tab))
    {
        emit ctrlTabPressed();
        return;
    }

    // shift + ctrl + tab action
    if ((event->modifiers() == Qt::ControlModifier + Qt::ShiftModifier) && (event->key() == Qt::Key_Backtab))
    {
        emit shiftCtrlTabPressed();
        return;
    }

    KMainWindow::keyPressEvent(event);
}
示例#19
0
void MainWindow::fileSaveAs()
{
    WebTab *w = currentTab();
    KUrl srcUrl = w->url();
    
    // First, try with suggested file name...
    QString name = w->page()->suggestedFileName();

    // Second, with KUrl fileName...
    if (name.isEmpty())
    {
        name = srcUrl.fileName();
    }
    
    // Last chance...
    if(name.isEmpty())
    {
        name = srcUrl.host() + QString(".html");
    }
    
    const QString destUrl = KFileDialog::getSaveFileName(name, QString(), this);
    if (destUrl.isEmpty()) 
        return;
    
    KIO::Job *job = KIO::file_copy(srcUrl, KUrl(destUrl), -1, KIO::Overwrite);
    job->addMetaData("MaxCacheSize", "0");  // Don't store in http cache.
    job->addMetaData("cache", "cache");     // Use entry from cache if available.
    job->uiDelegate()->setAutoErrorHandlingEnabled(true);
}
示例#20
0
UserWnd *UserTabBar::currentWnd()
{
    QTab *t = tab(currentTab());
    if (t == NULL)
        return NULL;
    return static_cast<UserTab*>(t)->m_wnd;
}
示例#21
0
void MainWindow::noticeMessageReceived(IrcNoticeMessage *message)
{
  AbstractTab *tab = currentTab();
  if (tab == NULL) {
    tab = (AbstractTab *) m_ui.serverTab;
  }
  tab->noticeMessageReceived(message);
}
示例#22
0
void MainWindow::updateHighlight()
{
    if (!currentTab())
        return;

    QWebPage::FindFlags options = QWebPage::HighlightAllOccurrences;

    currentTab()->view()->findText("", options); //Clear an existing highlight

    if (m_findBar->highlightAllState() && !m_findBar->isHidden())
    {
        if (m_findBar->matchCase())
            options |= QWebPage::FindCaseSensitively;

        currentTab()->view()->findText(m_lastSearch, options);
    }
}
示例#23
0
void MainWindow::echoCommandReceived(const QString &text)
{
  AbstractTab *tab = currentTab();
  if (tab == NULL) {
    tab = (AbstractTab *) m_ui.serverTab;
  }
  tab->echoReceived(text);
}
示例#24
0
void MainWindow::on_actionSave_triggered()
{
  if (tabs[currentTab()].path.isEmpty())
  {
      saveFileAs();
  }else {
      saveFile();
  }
}
示例#25
0
void MainWindow::find(const QString & search)
{
    if (!currentTab())
        return;
    m_lastSearch = search;

    updateHighlight();
    findNext();
}
void ConnectionViewWidget::invalidateButtonStatus()
{
    if (currentTab() == ConnectionTab) {
        setEnabledRemoveButton(ui->connectionView->selectionModel()->hasSelection());
        setEnabledAddButton(true);
    } else if (currentTab() == BindingTab) {
        setEnabledRemoveButton(ui->bindingView->selectionModel()->hasSelection());
        BindingModel *bindingModel = qobject_cast<BindingModel*>(ui->bindingView->model());
        setEnabledAddButton(bindingModel->connectionView()->model() &&
            bindingModel->connectionView()->selectedModelNodes().count() == 1);

    } else if (currentTab() == DynamicPropertiesTab) {
        setEnabledRemoveButton(ui->dynamicPropertiesView->selectionModel()->hasSelection());
        DynamicPropertiesModel *dynamicPropertiesModel = qobject_cast<DynamicPropertiesModel*>(ui->dynamicPropertiesView->model());
        setEnabledAddButton(dynamicPropertiesModel->connectionView()->model() &&
            dynamicPropertiesModel->connectionView()->selectedModelNodes().count() == 1);
    }
}
示例#27
0
unsigned UserTabBar::current()
{
    unsigned n = 0;
    for (unsigned i = 0; i < (unsigned)currentTab(); i++){
        if (tab(i) == NULL)
            continue;
        n++;
    }
    return n;
}
void ConnectionViewWidget::dynamicPropertiesTableViewSelectionChanged(const QModelIndex &current, const QModelIndex & /*previous*/)
{
    if (currentTab() == DynamicPropertiesTab) {
        if (current.isValid()) {
            setEnabledRemoveButton(true);
        } else {
            setEnabledRemoveButton(false);
        }
    }
}
示例#29
0
void MainWindow::homePage(Qt::MouseButtons mouseButtons, Qt::KeyboardModifiers keyboardModifiers)
{
    KUrl homeUrl = ReKonfig::useNewTabPage()
        ? KUrl( QL1S("about:home") )
        : KUrl( ReKonfig::homePage() );

    if (mouseButtons == Qt::MidButton || keyboardModifiers == Qt::ControlModifier)
        Application::instance()->loadUrl( homeUrl, Rekonq::NewTab);
    else
        currentTab()->view()->load( homeUrl );
}
示例#30
0
文件: sidebar.cpp 项目: fagu/kileip
void SideBar::tabClicked(int i)
{
	int currentIndex = currentTab();

	if(i == currentIndex && !isMinimized()) {
		shrink();
	}
	else {
		switchToTab(i);
	}
}