void Stack::addDocument(Document* document) { document->setSceneList(m_scenes); connect(document, SIGNAL(alert(Alert*)), m_alerts, SLOT(addAlert(Alert*))); connect(document, SIGNAL(alignmentChanged()), this, SIGNAL(updateFormatAlignmentActions())); connect(document, SIGNAL(changedName()), this, SIGNAL(updateFormatActions())); connect(document, SIGNAL(footerVisible(bool)), this, SLOT(setFooterVisible(bool))); connect(document, SIGNAL(headerVisible(bool)), this, SLOT(setHeaderVisible(bool))); connect(document, SIGNAL(scenesVisible(bool)), this, SLOT(setScenesVisible(bool))); connect(document->text(), SIGNAL(copyAvailable(bool)), this, SIGNAL(copyAvailable(bool))); connect(document->text(), SIGNAL(redoAvailable(bool)), this, SIGNAL(redoAvailable(bool))); connect(document->text(), SIGNAL(undoAvailable(bool)), this, SIGNAL(undoAvailable(bool))); connect(document->text(), SIGNAL(currentCharFormatChanged(QTextCharFormat)), this, SIGNAL(updateFormatActions())); m_documents.append(document); m_contents->addWidget(document); m_contents->setCurrentWidget(document); QAction* action = new QAction(this); action->setCheckable(true); action->setActionGroup(m_menu_group); m_document_actions.push_back(action); m_menu->addAction(action); updateMenuIndexes(); document->loadTheme(m_theme); document->text()->setFixedSize(m_foreground_size); emit documentAdded(document); emit updateFormatActions(); }
bool Document::rename() { if (m_filename.isEmpty()) { return false; } QString selected; QString filename = QFileDialog::getSaveFileName(window(), tr("Rename File"), m_filename, fileFilter(m_filename), &selected); if (!filename.isEmpty()) { filename = fileNameWithExtension(filename, selected); if (QFile::exists(filename) && !QFile::remove(filename)) { QMessageBox::critical(window(), tr("Sorry"), tr("Unable to overwrite '%1'.").arg(filename)); return false; } if (!QFile::rename(m_filename, filename)) { QMessageBox::critical(window(), tr("Sorry"), tr("Unable to rename '%1'.").arg(m_filename)); return false; } m_filename = filename; updateSaveLocation(); m_text->document()->setModified(false); emit changedName(); return true; } else { return false; } }
bool Document::rename() { // Request new filename if (m_filename.isEmpty()) { return false; } QString filename = getSaveFileName(tr("Rename File")); if (filename.isEmpty()) { return false; } // Rename file if (QFile::exists(filename) && (DocumentWatcher::instance()->isWatching(filename) || !QFile::remove(filename))) { QMessageBox::critical(window(), tr("Sorry"), tr("Unable to overwrite '%1'.").arg(QDir::toNativeSeparators(filename))); return false; } DocumentWatcher::instance()->pauseWatch(this); if (!QFile::rename(m_filename, filename)) { DocumentWatcher::instance()->resumeWatch(this); QMessageBox::critical(window(), tr("Sorry"), tr("Unable to rename '%1'.").arg(QDir::toNativeSeparators(m_filename))); return false; } DocumentWatcher::instance()->resumeWatch(this); m_filename = filename; m_encoding.clear(); save(); updateSaveLocation(); m_text->document()->setModified(false); emit changedName(); return true; }
void Task::setName(QString name) { if (d->name != name) { d->name = name; emit changedName(); } }
bool Document::saveAs() { // Request new filename QString filename = getSaveFileName(tr("Save File As")); if (filename.isEmpty()) { return false; } if (m_filename == filename) { return save(); } // Save file as new name if (QFile::exists(filename) && (DocumentWatcher::instance()->isWatching(filename) || !QFile::remove(filename))) { QMessageBox::critical(window(), tr("Sorry"), tr("Unable to overwrite '%1'.").arg(QDir::toNativeSeparators(filename))); return false; } QByteArray encoding; std::swap(m_filename, filename); std::swap(m_encoding, encoding); if (!save()) { std::swap(m_filename, filename); std::swap(m_encoding, encoding); return false; } clearIndex(); updateSaveLocation(); m_text->setReadOnly(false); m_text->document()->setModified(false); emit changedName(); return true; }
bool Document::saveAs() { QString selected; QString filename = QFileDialog::getSaveFileName(window(), tr("Save File As"), m_filename, fileFilter(m_filename), &selected); if (!filename.isEmpty()) { filename = fileNameWithExtension(filename, selected); if (QFile::exists(filename) && !QFile::remove(filename)) { QMessageBox::critical(window(), tr("Sorry"), tr("Unable to overwrite '%1'.").arg(QDir::toNativeSeparators(filename))); return false; } qSwap(m_filename, filename); if (!save()) { m_filename = filename; return false; } clearIndex(); updateSaveLocation(); m_text->setReadOnly(false); m_text->document()->setModified(false); emit changedName(); return true; } else { return false; } }
void KTExposureHeader::hideEditorName() { m_editor->hide(); if (m_sectionEdited != -1 && m_editor->isModified()) emit changedName(m_sectionEdited, m_editor->text()); m_sectionEdited = -1; }
void Stack::addDocument(Document* document) { document->setSceneList(m_scenes); connect(document, SIGNAL(alert(Alert*)), m_alerts, SLOT(addAlert(Alert*))); connect(document, SIGNAL(alignmentChanged()), this, SIGNAL(updateFormatAlignmentActions())); connect(document, SIGNAL(changedName()), this, SIGNAL(updateFormatActions())); connect(document, SIGNAL(changedName()), this, SLOT(updateMapping())); connect(document, SIGNAL(footerVisible(bool)), this, SLOT(setFooterVisible(bool))); connect(document, SIGNAL(headerVisible(bool)), this, SLOT(setHeaderVisible(bool))); connect(document, SIGNAL(scenesVisible(bool)), this, SLOT(setScenesVisible(bool))); connect(document->text(), SIGNAL(copyAvailable(bool)), this, SIGNAL(copyAvailable(bool))); connect(document->text(), SIGNAL(redoAvailable(bool)), this, SIGNAL(redoAvailable(bool))); connect(document->text(), SIGNAL(undoAvailable(bool)), this, SIGNAL(undoAvailable(bool))); connect(document->text(), SIGNAL(currentCharFormatChanged(QTextCharFormat)), this, SIGNAL(updateFormatActions())); m_documents.append(document); m_contents->addWidget(document); m_contents->setCurrentWidget(document); updateMapping(); emit documentAdded(document); emit updateFormatActions(); }
void Document::setRichText(bool rich_text) { // Get new file name m_old_states[m_text->document()->availableUndoSteps()] = qMakePair(m_filename, m_rich_text); if (!m_filename.isEmpty()) { QString filename = m_filename; int suffix_index = filename.lastIndexOf(QChar('.')); int file_index = filename.lastIndexOf(QChar('/')); if (suffix_index > file_index) { filename.chop(filename.length() - suffix_index); } filename.append(rich_text ? ".proseup" : ".txt"); QString selected; m_filename = QFileDialog::getSaveFileName(window(), tr("Save File As"), filename, fileFilter(filename), &selected); if (!m_filename.isEmpty()) { m_filename = fileNameWithExtension(m_filename, selected); clearIndex(); } else { findIndex(); } } // Set file type m_rich_text = rich_text; m_text->setAcceptRichText(m_rich_text); // Always remove formatting to have something to undo QTextCursor cursor(m_text->document()); cursor.beginEditBlock(); cursor.movePosition(QTextCursor::End, QTextCursor::KeepAnchor); cursor.setBlockFormat(QTextBlockFormat()); cursor.setCharFormat(QTextCharFormat()); cleanUpDocument(); cursor.endEditBlock(); m_old_states[m_text->document()->availableUndoSteps()] = qMakePair(m_filename, m_rich_text); // Save file if (!m_filename.isEmpty()) { save(); updateState(); m_text->document()->setModified(false); } emit changedName(); emit formattingEnabled(m_rich_text); }
void ChatList::addChatWindow(ChatWindow* chatw) { connect(m_mainWindow, SIGNAL(closing()), chatw, SLOT(save())); int listSize = m_chatWindowList.size(); beginInsertRows(QModelIndex(), listSize, listSize); m_chatMenu.addAction(chatw->toggleViewAction()); connect(chatw, SIGNAL(ChatWindowHasChanged(ChatWindow *)), this, SLOT(changeChatWindow(ChatWindow *))); QMdiSubWindow* subWindowChat = static_cast<QMdiSubWindow*>(m_mainWindow->registerSubWindow(chatw,chatw->toggleViewAction())); connect(chatw->chat(), SIGNAL(changedName(QString)), subWindowChat, SLOT(setWindowTitle(QString))); m_chatWindowList.append(chatw); m_chatSubWindowList.append(subWindowChat); if((subWindowChat->height()<451)||(subWindowChat->width()<264)) { subWindowChat->resize(264,451); } if(NULL!=subWindowChat) { chatw->setSubWindow(subWindowChat); subWindowChat->setWindowTitle(tr("%1 (Chat)").arg(chatw->getTitleFromChat())); subWindowChat->setWindowIcon(QIcon(":/chat.png")); subWindowChat->setAttribute(Qt::WA_DeleteOnClose, false); chatw->setAttribute(Qt::WA_DeleteOnClose, false); subWindowChat->setVisible(chatw->toggleViewAction()->isChecked()); } endInsertRows(); }
void BeerXMLElement::setName(const QString var) { set( "name", "name", var ); _name = var; emit changedName(var); }
//================================"SET" METHODS================================= void MashStep::setName( const QString &var ) { set("name", "name", var); emit changedName(var); }
void PlayerChat::verifyName(Player * player) { if (player == m_player) emit changedName(m_player->name()); }
//============================="SET" METHODS==================================== void Yeast::setName( const QString& var ) { set("name", "name", var); emit changedName(var); }