void pChild::closeFile() { mEditor->closeFile(); setFilePath( QString::null ); emit fileClosed(); }
void CorePlugin::fileRenamed(const QString &pOldFileName, const QString &pNewFileName) { // Remove the new file from our list of recent files, should it be there // Note: it's fine if the new file isn't in our list since nothing will be // done in that case (thus avoiding us having to test for its // presence)... mRecentFileNamesOrUrls.removeOne(pNewFileName); // A file has been created or saved under a new name, so we want the old // file name to be added to our list of recent files, i.e. as if it had been // closed fileClosed(pOldFileName); }
/** * Closes an edited file. * @param bForce true to close the file regardless of any modifications, * false to prompt the user in case of unsaved chnages * @return true if the file has been closed, false if the user has aborted */ bool EditorPage::close(bool bForce) { QString sPath; // To override the prompt-on-close behaviour, we need to mark the file // as unmodified if (bForce) m_pDoc->setModified(false); // Close the file, unless the user aborts the action sPath = m_pDoc->url().path(); if (!m_pDoc->closeURL()) return false; emit fileClosed(sPath); return true; }
PluginTextEditor::PluginTextEditor() { ProjectManager *projectmanager = IPlatform::getInstance()->getProjectManager(); Window *window = IPlatform::getInstance()->getWindowManager()->getWindow(); QTabWidget *tabwidget = window->getTabWidget(); QTextEdit *textedit = new QTextEdit(tr("Welcome!"), tabwidget); textedit->setReadOnly(true); tabwidget->addTab(textedit, tr("Welcome")); Settings *settings = window->getSettingsDialog(); PluginPage *pluginpage = new PluginPage(settings); settings->addSettingsPage(pluginpage); connect(projectmanager, SIGNAL(fileOpened(QString)), this, SLOT(openFile(QString))); connect(projectmanager, SIGNAL(fileClosed(QString)), this, SLOT(closeFile(QString))); connect(window, SIGNAL(closeTabRequested(QString)), this, SLOT(closeFileRequest(QString))); }
/** * Closes an edited file. * @param bForce true to close the file regardless of any modifications, * false to prompt the user in case of unsaved chnages * @return true if the file has been closed, false if the user has aborted */ bool EditorPage::close(bool bForce) { QString sPath; // To override the prompt-on-close behaviour, we need to mark the file // as unmodified if (bForce) m_pDoc->setModified(false); // Close the file, unless the user aborts the action sPath = m_pDoc->url().path(); m_pDoc->documentSave(); // emit KTextEditor::Document::aboutToClose(m_pDoc); delete m_pDoc; //if (!m_pDoc->closeURL()) // return false; emit fileClosed(sPath); return true; }
void EditorBase::closeEvent(QCloseEvent *event) { // Check if we need to save if(m_modified) { // Display the dialog int r = QMessageBox::question(this, "Save", "Do you want to save the changes?", QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel); if(r == QMessageBox::Yes) { // Yes, save here save(); } else if(r == QMessageBox::Cancel) { // Cancel the close operation event->ignore(); return; } // No need for saving setModified(false); } m_mdiWindow->close(); emit fileClosed(m_filePath); }
void QtDesignerChild::closeFile() { createNewForm(); setFilePath( QString::null ); emit fileClosed(); }
void OpenFileManager::deregisterFile(BaseFile* file) { if (mOpenFiles.removeAll(file)) emit fileClosed(file); }