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); } }
QString MainWindow::selectedText() const { if (!currentTab()) return QString(); return currentTab()->view()->selectedText(); }
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(); }
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 ); }
void MainWindow::viewPageSource() { if (!currentTab()) return; KUrl url = currentTab()->url(); KRun::runUrl(url, QL1S("text/plain"), this, false); }
void MainWindow::search() { if(currentTab() && currentTab()->textEdit()) { searchDialog->setEditor(currentTab()->textEdit()); searchDialog->show(); } }
void MainWindow::switchToNextTab() { if (currentTab() != (tabs.size() - 1)) { ui->tabWidget->setCurrentIndex(currentTab() + 1); }else { ui->tabWidget->setCurrentIndex(0); } }
void MainWindow::matchCaseUpdate() { if (!currentTab()) return; currentTab()->view()->findText(m_lastSearch, QWebPage::FindBackward); findNext(); updateHighlight(); }
void MainWindow::switchToPrevTab() { if (currentTab() != 0) { ui->tabWidget->setCurrentIndex(currentTab() - 1); } else { ui->tabWidget->setCurrentIndex(tabs.size() - 1); } }
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(); } }
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(); }
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 }
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(); }
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()); }
void MainWindow::saveFile() { QFile file(tabs[currentTab()].path); if (file.open(QIODevice::WriteOnly|QIODevice::Text)) { file.write(ui->textEdit->toPlainText().toUtf8()); } }
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); }
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); }
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); }
UserWnd *UserTabBar::currentWnd() { QTab *t = tab(currentTab()); if (t == NULL) return NULL; return static_cast<UserTab*>(t)->m_wnd; }
void MainWindow::noticeMessageReceived(IrcNoticeMessage *message) { AbstractTab *tab = currentTab(); if (tab == NULL) { tab = (AbstractTab *) m_ui.serverTab; } tab->noticeMessageReceived(message); }
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); } }
void MainWindow::echoCommandReceived(const QString &text) { AbstractTab *tab = currentTab(); if (tab == NULL) { tab = (AbstractTab *) m_ui.serverTab; } tab->echoReceived(text); }
void MainWindow::on_actionSave_triggered() { if (tabs[currentTab()].path.isEmpty()) { saveFileAs(); }else { saveFile(); } }
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); } }
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 ¤t, const QModelIndex & /*previous*/) { if (currentTab() == DynamicPropertiesTab) { if (current.isValid()) { setEnabledRemoveButton(true); } else { setEnabledRemoveButton(false); } } }
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 ); }
void SideBar::tabClicked(int i) { int currentIndex = currentTab(); if(i == currentIndex && !isMinimized()) { shrink(); } else { switchToTab(i); } }