RKCommandEditorWindow::RKCommandEditorWindow (QWidget *parent, bool use_r_highlighting) : RKMDIWindow (parent, RKMDIWindow::CommandEditorWindow) {
	RK_TRACE (COMMANDEDITOR);

	KLibFactory *factory = KLibLoader::self()->factory( "libkatepart" );
	if (factory) {
		// Create the part
		m_doc = (Kate::Document *) factory->create( this, "katepart", "KParts::ReadWritePart" );
		RK_ASSERT (m_doc);
		m_view = (Kate::View *) m_doc->widget();
	}

	// strip down the khtmlpart's GUI. remove some stuff we definitely don't need.
	RKCommonFunctions::removeContainers (m_doc, QStringList::split (',', "bookmarks,tools_spelling,tools_spelling_from_cursor,tools_spelling_selection,switch_to_cmd_line"), true);
	RKCommonFunctions::moveContainer (m_doc, "Menu", "tools", "edit", true);

	m_doc->insertChildClient (new RKCommandEditorWindowPart (m_view, this));

	QHBoxLayout *pLayout = new QHBoxLayout( this, 0, -1, "layout");
	pLayout->addWidget(m_view);

	setIcon (SmallIcon ("source"));

	connect (m_doc, SIGNAL (fileNameChanged ()), this, SLOT (updateCaption ()));
	connect (m_doc, SIGNAL (modifiedChanged ()), this, SLOT (updateCaption ()));		// of course most of the time this causes a redundant call to updateCaption. Not if a modification is undone, however.
	if (use_r_highlighting) setRHighlighting ();

	updateCaption ();	// initialize
}
Пример #2
0
void QtDesignerChild::saveFile()
{
    // cancel if not modified
    if ( !mHostWidget->formWindow()->isDirty() )
    {
        return;
    }

    // write file
    QFile file( mHostWidget->formWindow()->fileName() );

    if ( file.open( QIODevice::WriteOnly ) )
    {
        file.resize( 0 );
        file.write( mHostWidget->formWindow()->contents().toUtf8() );
        file.close();

        mHostWidget->formWindow()->setDirty( false );
        setWindowModified( false );

        emit modifiedChanged( false );
    }
    else
    {
        MonkeyCore::messageManager()->appendMessage( tr( "An error occurs when saving :\n%1" ).arg( mHostWidget->formWindow()->fileName() ) );
    }

    return;
}
Пример #3
0
void Document::setModified(bool modified)
{
	if (d->modified == modified)
		return;
	d->modified = modified;
	emit modifiedChanged(modified);
}
Пример #4
0
void Document::setModified(bool modified)
{
    if (m_modified != modified) {
        m_modified = modified;
        emit modifiedChanged();
    }
}
Пример #5
0
void SettingsWidget::setModified(bool modified)
{
	const bool oldModified = isModified();
	p->modified = modified;
	if (oldModified != isModified())
		emit modifiedChanged(!oldModified);
}
Пример #6
0
void MainWindow::addChild(const QString& imageFileName) {
  if (!imageFileName.isEmpty()) {
    QString canonicalImageFileName =
      QFileInfo(imageFileName).canonicalFilePath();
    for (int i = 0; i < tabWidget->count(); ++i) {
      ChildWidget* child = qobject_cast<ChildWidget*> (tabWidget->widget(i));
      if (canonicalImageFileName == child->canonicalImageFileName()) {
        tabWidget->setCurrentIndex(i);
        return;
      }
    }

    ChildWidget* child = new ChildWidget(this);
    if (child->loadImage(imageFileName)) {
      statusBar()->showMessage(tr("File loaded"), 2000);
      tabWidget->setCurrentIndex(tabWidget->addTab(child,
                                 child->userFriendlyCurrentFile()));
      tabWidget->setTabToolTip(tabWidget->currentIndex(), imageFileName);
      connect(child, SIGNAL(boxChanged()), this, SLOT(updateCommandActions()));
      connect(child, SIGNAL(modifiedChanged()), this, SLOT(updateTabTitle()));
      connect(child, SIGNAL(modifiedChanged()), this, SLOT(updateSaveAction()));
      connect(child, SIGNAL(zoomRatioChanged(qreal)), this,
              SLOT(zoomRatioChanged(qreal)));
      connect(child, SIGNAL(statusBarMessage(QString)), this,
              SLOT(statusBarMessage(QString)));
      connect(child, SIGNAL(drawRectangleChoosen()), this, SLOT(updateCommandActions()));
      child->setZoomStatus();
      // save path of open image file
      QSettings settings(QSettings::IniFormat, QSettings::UserScope,
                         SETTING_ORGANIZATION, SETTING_APPLICATION);
      QString filePath = QFileInfo(imageFileName).absolutePath();
      settings.setValue("last_path", filePath);

      QStringList files = settings.value("recentFileList").toStringList();
      files.removeAll(imageFileName);
      files.prepend(imageFileName);
      while (files.size() > MaxRecentFiles)
        files.removeLast();

      settings.setValue("recentFileList", files);

      foreach(QWidget * widget, QApplication::topLevelWidgets()) {
        MainWindow* mainWin = qobject_cast<MainWindow*>(widget);
        if (mainWin)
          mainWin->updateRecentFileActions();
      }
Пример #7
0
void Document::setModified(bool m)
{
	// If file not saved, modified is always true.
	//if (m_modified != m)	// Sometimes want to force an update by invoking the signal.
	{
		m_modified = m;
		emit modifiedChanged(m_modified);
	}
}
Пример #8
0
void ChatAppearance::onThemeChanged(int index)
{
	m_currentStyleName = ui->chatBox->itemText(index);
	m_controller->loadTheme(m_currentStyleName);
	makePage();
	if (!isLoad)
		emit modifiedChanged(true);
	isLoad = false;
}
Пример #9
0
void SettingsWidget::onStateChanged(int index)
{
	if (index < 0 || index >= p->infos.size() || p->sleep)
		return;
	WidgetInfo &info = p->infos[index];
	QVariant value = info.obj.data()->property(info.property);
	bool equal = info.value == value;
	if (equal && info.is_changed)
		p->changed_num--;
	else if (!info.is_changed && !equal)
		p->changed_num++;
	else
		return;
	info.is_changed = !equal;
	if (p->changed_num == 0 && equal)
		emit modifiedChanged(false);
	else if (p->changed_num == 1 && !equal)
		emit modifiedChanged(true);
}
Пример #10
0
void ChatAppearance::onThemeChanged(int index)
{
	m_current_style_name = ui->chatBox->itemText(index);
	m_controller->loadTheme(ThemeManager::path("webkitstyle",m_current_style_name),m_current_variant);
	makePage();
	makeSettings();
	if (!isLoad)
		emit modifiedChanged(true);
	isLoad = false;
}
Пример #11
0
void SettingsWidget::save()
{
	if(!isModified())
		return;
	p->sleep = true;
	saveImpl();
	p->clearValues();
	p->sleep = false;
	emit saved();
	emit modifiedChanged(false);
}
Пример #12
0
void SiteResponseModel::setModified(bool modified)
{
    m_modified = modified;
    emit modifiedChanged(modified);

    //     FIXME
    //    if (m_modified != modified && m_isLoaded) {
    //        // FIXME When opening a previously saved document, the QTextDocument
    //        // containing the notes signals that it has been modified.  This happens
    //        // before the modified flag is reset.
    //    }
}
Пример #13
0
void ChatAppearance::onVariableChanged()
{
	QString css;
	foreach (ChatVariable *widget, m_current_variables)
		if (widget)
			css.append(QString("%1 { %2: %3; } ")
					   .arg(widget->chatStyle().selector)
					   .arg(widget->chatStyle().parameter)
					   .arg(widget->chatStyle().value));
	m_controller->setCustomCSS(css);
	emit modifiedChanged(true);
}
Пример #14
0
void MainWindow::addChild(const QString &imageFileName)
{
  if (!imageFileName.isEmpty()) {
    QString canonicalImageFileName = QFileInfo(imageFileName).canonicalFilePath();
    for (int i = 0; i < tabWidget->count(); ++i) {
      ChildWidget *child = qobject_cast<ChildWidget *> (tabWidget->widget(i));
      if (canonicalImageFileName == child->canonicalImageFileName()) {
        tabWidget->setCurrentIndex(i);
        return;
      }
    }

    ChildWidget *child = new ChildWidget;
    if (child->loadImage(imageFileName)) {
      statusBar()->showMessage(tr("File loaded"), 2000);
      tabWidget->setCurrentIndex(tabWidget->addTab(child, child->userFriendlyCurrentFile()));
      connect(child, SIGNAL(boxChanged()), this, SLOT(updateCommandActions()));
      connect(child, SIGNAL(modifiedChanged()), this, SLOT(updateTabTitle()));
      connect(child, SIGNAL(modifiedChanged()), this, SLOT(updateSaveAction()));
    } else {
      child->close();
    }
  }
}
Пример #15
0
bool MyEventFilter::eventFilter(QObject* obj, QEvent* event)
{
	if (event->type() == QEvent::WindowTitleChange)
	{
		QWidget* window = qobject_cast<QWidget*>(obj);
		if (window)
			emit windowTitleChanged(window->windowTitle());
	}
	else if (event->type() == QEvent::ModifiedChange)
	{
		QWidget* window = qobject_cast<QWidget*>(obj);
		if (window)
			emit modifiedChanged(window->isWindowModified());
	}

	return QObject::eventFilter(obj, event);
}
Пример #16
0
void SettingsWidget::cancel()
{
	if(!isModified())
		return;
	p->sleep = true;
	for(int i = 0, size = p->infos.size(); i < size; i++)
	{
		WidgetInfo &info = p->infos[i];
		if(info.obj && info.is_changed)
			 info.obj.data()->setProperty(info.property, info.value);
		info.is_changed = false;
	}
	cancelImpl();
	p->changed_num = 0;
	p->modified = false;
	p->sleep = false;
	emit modifiedChanged(false);
}
Пример #17
0
//-----------------------------------------------------------------------------
// Function: TabDocument::setModified()
//-----------------------------------------------------------------------------
void TabDocument::setModified(bool modified)
{
	if (modified == modified_)
    {
		return;
    }

    if (modified)
    {
        setTabTitle(docName_ + docType_ + "*");
    }
    else
    {
        setTabTitle(docName_ + docType_);
    }

    modified_ = modified;
	emit modifiedChanged(modified_);
}
Пример #18
0
void FileInfo::readFile()
{
    m_errorMessage = "";

    m_fileInfo = QFileInfo(m_file);
    if (!m_fileInfo.exists())
        m_errorMessage = tr("File does not exist");

    emit fileChanged();
    emit kindChanged();
    emit iconChanged();
    emit permissionsChanged();
    emit sizeChanged();
    emit modifiedChanged();
    emit createdChanged();
    emit absolutePathChanged();
    emit nameChanged();
    emit suffixChanged();
    emit symLinkTargetChanged();
    emit errorMessageChanged();
}
Пример #19
0
void QtDesignerChild::formGeometryChanged()
{
    // set modified state
    bool loading = property( "loadingFile" ).toBool();
    bool modified = !loading;

    // update property
    QDesignerPropertySheetExtension* sheet = qt_extension<QDesignerPropertySheetExtension*>( mDesignerManager->core()->extensionManager(), mHostWidget->formWindow() );
    QRect geo = sheet->property( sheet->indexOf( "geometry" ) ).toRect();
    geo.moveTopLeft( QPoint( 0, 0 ) );
    delete sheet;
    mDesignerManager->core()->propertyEditor()->setPropertyValue( "geometry", geo, modified );

    // update state
    mHostWidget->formWindow()->setDirty( modified );
    setWindowModified( modified );
    setProperty( "loadingFile", false );

    // emit modified state
    emit modifiedChanged( modified );
    emit contentChanged();
}
Пример #20
0
void IcqMainSettings::extSettingsChanged()
{
	emit modifiedChanged(true);
}
Пример #21
0
void ProtocolChooserWidget::onItemChanged(QStandardItem* )
{
	emit modifiedChanged(true);
}
Пример #22
0
void Maemo5Settings::onSettingsChanged()
{
	emit modifiedChanged(true);
}
Пример #23
0
void IconLoaderSettings::onCurrentIndexChanged(int index)
{
	emit modifiedChanged(index != m_index);
}
Пример #24
0
void SettingsWidget::onModified()
{
	emit modifiedChanged(true);
}
Пример #25
0
void SettingsWidget::on_addButton_clicked()
{
	addAnswer();
	emit modifiedChanged(true);
}
Пример #26
0
void QtDesignerChild::formChanged()
{
    setWindowModified( mHostWidget->formWindow()->isDirty() );
    emit modifiedChanged( mHostWidget->formWindow()->isDirty() );
    emit contentChanged();
}
Пример #27
0
 void ArtworkMetadata::markModified() {
     if (!getIsModifiedFlag()) {
         setIsModifiedFlag(true);
         emit modifiedChanged(true);
     }
 }
Пример #28
0
void VAccountSettings::onPasswdChanged(const QString &)
{
	emit modifiedChanged(true);
}
Пример #29
0
void ChatAppearance::onVariantChanged(const QString variant)
{
	m_current_variant = variant;
	m_controller->setVariant(m_current_variant);
	emit modifiedChanged(true);
}