diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | e9ae80694875f869892f13f4fcaf1170a00dea41 (patch) | |
tree | aa2f8d8a217e2d376224c8d46b7397b68d35de2d /quanta/dialogs | |
download | tdewebdev-e9ae80694875f869892f13f4fcaf1170a00dea41.tar.gz tdewebdev-e9ae80694875f869892f13f4fcaf1170a00dea41.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdewebdev@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'quanta/dialogs')
68 files changed, 12530 insertions, 0 deletions
diff --git a/quanta/dialogs/Makefile.am b/quanta/dialogs/Makefile.am new file mode 100644 index 00000000..9a63dd23 --- /dev/null +++ b/quanta/dialogs/Makefile.am @@ -0,0 +1,18 @@ +noinst_LTLIBRARIES = libdialogs.la + +libdialogs_la_SOURCES = copyto.cpp dirtydialog.ui dirtydlg.cpp \ + donationdialog.ui dtdselectdialog.ui fourbuttonmessagebox.ui casewidget.ui \ + actionconfigdialogs.ui actionconfigdialog.cpp filecombo.cpp specialchardialogs.ui \ + specialchardialog.cpp dtepeditdlgs.ui dtepstructureeditdlgs.ui dtepeditdlg.cpp \ + loadentitydlgs.ui + +METASOURCES = AUTO + +AM_CPPFLAGS = -I$(top_srcdir)/lib \ + -I$(top_srcdir)/quanta/utility \ + -I$(top_srcdir)/quanta/parsers \ + -I$(top_srcdir)/quanta/src \ + $(KMDI_INCLUDES) $(all_includes) + +SUBDIRS = settings tagdialogs + diff --git a/quanta/dialogs/actionconfigdialog.cpp b/quanta/dialogs/actionconfigdialog.cpp new file mode 100644 index 00000000..9a4cfb3d --- /dev/null +++ b/quanta/dialogs/actionconfigdialog.cpp @@ -0,0 +1,933 @@ +/*************************************************************************** + actionconfigdialog.cpp + --------------------- + copyright : (C) 2003 by Andras Mantia <amantia@kde.org> + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; version 2 of the License. * + * * + ***************************************************************************/ + +//qt includes +#include <qbuttongroup.h> +#include <qcheckbox.h> +#include <qdom.h> +#include <qfileinfo.h> +#include <qlineedit.h> +#include <qlistbox.h> +#include <qmultilineedit.h> +#include <qradiobutton.h> +#include <qtabwidget.h> +#include <qregexp.h> + +//kde includes +#include <kapplication.h> +#include <kconfig.h> +#include <kdebug.h> +#include <kicondialog.h> +#include <kiconloader.h> +#include <kkeybutton.h> +#include <klistview.h> +#include <klocale.h> +#include <kmainwindow.h> +#include <kmessagebox.h> +#include <kpopupmenu.h> +#include <kpushbutton.h> +#include <kstandarddirs.h> +#include <kdeversion.h> +#include <kinputdialog.h> +#include <ktoolbar.h> + +//app includes +#include "resource.h" +#include "filecombo.h" + +#include "actionconfigdialog.h" +#include "tagaction.h" +#include "toolbartabwidget.h" + +ActionConfigDialog::ActionConfigDialog(const QDict<ToolbarEntry> &toolbarList, KMainWindow* parent, const char* name, bool modal, WFlags fl, const QString& defaultAction ) + :ActionConfigDialogS( parent, name, modal, fl ) +{ + m_mainWindow = parent; + m_toolbarList = toolbarList; + buttonOk->setIconSet(SmallIconSet("button_ok")); + buttonCancel->setIconSet(SmallIconSet("button_cancel")); + buttonApply->setIconSet(SmallIconSet("apply")); + //buttonHelp->setIconSet(SmallIconSet("help")); + + currentAction = 0L; + m_toolbarItem = 0L; + + connect(actionTreeView, SIGNAL(contextMenu(KListView *,QListViewItem *,const QPoint &)), + SLOT(slotContextMenu(KListView *,QListViewItem *,const QPoint &))); + connect(actionTreeView, SIGNAL(selectionChanged(QListViewItem *)), + SLOT(slotSelectionChanged(QListViewItem *))); + connect(shortcutKeyButton, SIGNAL(capturedShortcut(const KShortcut &)), + SLOT(slotShortcutCaptured(const KShortcut &))); + connect(scriptPath, SIGNAL(activated(const QString&)), + SLOT(slotTextChanged(const QString&))); + connect(this, SIGNAL(addToolbar()), m_mainWindow, SLOT(slotAddToolbar())); + connect(this, SIGNAL(removeToolbar(const QString&)), m_mainWindow, SLOT(slotRemoveToolbar(const QString&))); + connect(this, SIGNAL(deleteUserAction(KAction*)), m_mainWindow, SLOT(slotDeleteAction(KAction*))); + connect(this, SIGNAL(configureToolbars(const QString&)), m_mainWindow, SLOT(slotConfigureToolbars(const QString&))); +//fill up the tree view with the toolbars and actions + actionTreeView->setSorting(-1); + allActionsItem = new KListViewItem(actionTreeView, i18n("All")); + actionTreeView->insertItem(allActionsItem); + QListViewItem *item, *oldItem = allActionsItem; + KAction *action; + QString toolbarName; + QString toolbarId; + ToolbarTabWidget *tb = ToolbarTabWidget::ref(); + QRegExp r("\\&(?!\\&)"); + KActionCollection *ac = m_mainWindow->actionCollection(); + for (int i = 0; i < tb->count(); i++) + { + toolbarName = tb->label(i); + toolbarName.replace(r, ""); + item = new KListViewItem(actionTreeView, oldItem, i18n(toolbarName.utf8())); + actionTreeView->insertItem(item); + + toolbarId = tb->id(i); + QListViewItem *oldActionItem = 0L; + ToolbarEntry *p_toolbar = m_toolbarList[toolbarId]; + if (p_toolbar) + { + QDomNode node = p_toolbar->guiClient->domDocument().firstChild().firstChild().firstChild(); + while (!node.isNull()) + { + if (node.nodeName() == "Action") + { + action = ac->action(node.toElement().attribute("name")); + if (action) + { + oldActionItem = new KListViewItem(item, oldActionItem, action->text().replace(r,""), action->shortcut().toString(), action->name()); + oldActionItem->setPixmap(0, SmallIcon(action->icon()) ); + } + } + node = node.nextSibling(); + } + if (tb->label(tb->currentPageIndex()).replace(r, "") == toolbarName) + { + item->setOpen(true); + if (item->firstChild()) + { + if (defaultAction.isEmpty()) + { + actionTreeView->setCurrentItem(item->firstChild()); + } else + { + QListViewItem *actionItem = item->firstChild(); + while (actionItem && actionItem->depth() > 0) + { + if (actionItem->text(0) == defaultAction || actionItem->text(0) == defaultAction + "...") + { + actionTreeView->setCurrentItem(actionItem); + break; + } + actionItem = actionItem->nextSibling(); + } + } + } + } + } + oldItem = item; + } + uint acCount = ac->count(); + for (uint i = 0; i < acCount; i++) + { + action = ac->action(i); + item = new KListViewItem(allActionsItem, action->text().replace(r, ""), action->shortcut().toString(), action->name()); + item->setPixmap(0, SmallIcon(action->icon()) ); + } + allActionsItem->sortChildItems(0, true); + + treeMenu = new KPopupMenu(actionTreeView); + treeMenu->insertItem(i18n("&Add New Toolbar"), this, SLOT(slotAddToolbar())); + treeMenu->insertItem(i18n("&Remove Toolbar"), this, SLOT(slotRemoveToolbar())); + treeMenu->insertItem(i18n("&Edit Toolbar"), this, SLOT(slotEditToolbar())); + + globalShortcuts = KGlobal::config()->entryMap( "Global Shortcuts" ); +} + +ActionConfigDialog::~ActionConfigDialog() +{ +} + +void ActionConfigDialog::slotAddToolbar() +{ + emit addToolbar(); + QString toolbarName; + QListViewItem *item; + ToolbarTabWidget *tb = ToolbarTabWidget::ref(); + for (int i = 0; i < tb->count(); i++) + { + toolbarName = tb->label(i); + if (!actionTreeView->findItem(toolbarName, 0)) + { + item = actionTreeView->lastItem(); + if (item->parent()) + item = item->parent(); + new KListViewItem(actionTreeView, item, i18n(toolbarName.utf8())); + break; + } + } +} + +void ActionConfigDialog::slotRemoveToolbar() +{ + QListViewItem *item = actionTreeView->currentItem(); + QString s = item->text(0); + if (item->parent()) + { + item = item->parent(); + s = item->text(0); + } + if (s != i18n("All")) + { + if ( KMessageBox::warningContinueCancel(this, i18n("Do you really want to remove the \"%1\" toolbar?").arg(s),QString::null,KStdGuiItem::del()) == KMessageBox::Continue ) + { + m_toolbarItem = item; + connect(m_mainWindow, SIGNAL(toolbarRemoved(const QString&)), SLOT(slotToolbarRemoved(const QString&))); + emit removeToolbar(s.lower()); + } + } +} + +void ActionConfigDialog::slotToolbarRemoved(const QString &/*name*/) +{ + actionTreeView->setCurrentItem(allActionsItem); + delete m_toolbarItem; + m_toolbarItem = 0L; + disconnect(m_mainWindow, SIGNAL(toolbarRemoved(const QString&)), this, SLOT(slotToolbarRemoved(const QString&))); +} + +void ActionConfigDialog::slotEditToolbar() +{ + QString toolbarName; + QString toolbarId; + QListViewItem *oldItem; + QListViewItem *item = actionTreeView->currentItem(); + if (item->parent()) + item = item->parent(); + toolbarName = item->text(0); + if ( toolbarName != i18n("All")) + { + emit configureToolbars(toolbarName +" <quanta>"); + + //update the tree view + KAction *action; + KActionCollection *ac = m_mainWindow->actionCollection(); + ToolbarTabWidget *tb = ToolbarTabWidget::ref(); + for (int i = 0; i < tb->count(); i++) + { + toolbarName = tb->label(i); + toolbarId = tb->id(i); + ToolbarEntry *p_toolbar = m_toolbarList[toolbarId]; + if (p_toolbar) + { + oldItem = actionTreeView->findItem(toolbarName, 0); + item = new KListViewItem(actionTreeView, oldItem, toolbarName); + item->setOpen(oldItem->isOpen()); + delete oldItem; + QDomNode node = p_toolbar->guiClient->domDocument().firstChild().firstChild().firstChild(); + while (!node.isNull()) + { + if (node.nodeName() == "Action") + { + action = ac->action(node.toElement().attribute("name")); + if (action) + { + oldItem = new KListViewItem(item, oldItem, action->text().replace(QRegExp("\\&(?!\\&)"),""), action->shortcut().toString(), action->name()); + oldItem->setPixmap(0, SmallIcon(action->icon())); + } + } + node = node.nextSibling(); + } + } + } + actionTreeView->setCurrentItem(allActionsItem); + actionTreeView->setSelected(allActionsItem, true); + } +} + +void ActionConfigDialog::slotContextMenu(KListView *,QListViewItem *,const QPoint &point) +{ + treeMenu->popup(point); +} + +void ActionConfigDialog::slotSelectionChanged(QListViewItem *item) +{ + if (currentAction && currentAction->inherits("TagAction")) + { + if ( buttonApply->isEnabled() && + KMessageBox::questionYesNo(this, i18n("Do you want to save the changes made to this action?"), QString::null, KStdGuiItem::save(), KStdGuiItem::discard()) == KMessageBox::Yes ) + { + saveCurrentAction(); + } + buttonApply->setEnabled(false); + currentAction = 0L; + } + if (item && item->depth() > 0) + { + TagAction *action = 0L; + KActionCollection *ac = m_mainWindow->actionCollection(); + uint acCount = ac->count(); +//find the corresponding action + for (uint i = 0; i < acCount; i++) + { + KAction *a = ac->action(i); + QString actionName = a->name(); + if (a && actionName == item->text(2) && a->inherits("TagAction")) + { + action = static_cast<TagAction*>(a); + actionProperties->setEnabled(true); + deleteAction->setEnabled(true); + break; + } else + { + actionProperties->setEnabled(false); + deleteAction->setEnabled(false); + } + } + + //if we found the action, load the action details + if (action) + { + currentAction = action; + QDomElement el = action->data(); + if ( el.hasAttribute("icon") ) + { + QString s = el.attribute("icon"); + if (!QFileInfo(s).exists()) + s = QFileInfo(s).fileName(); + actionIcon->setIcon(s); + } + QString actionText = el.attribute("text"); + actionText.replace(QRegExp("\\&(?!\\&)"),""); + lineText->setText(actionText); + lineToolTip->setText( el.attribute("tooltip") ); + selectedShortcut = action->shortcut(); + QString shortcutText = action->shortcut().toString(); + if (shortcutText.isEmpty()) + { + noShortcut->setChecked(true); + shortcutKeyButton->setText(i18n("None")); + } else + { + customShortcut->setChecked(true); + shortcutKeyButton->setShortcut(action->shortcut(), false); + shortcutKeyButton->setText(shortcutText); + } + +//find the container toolbars of this action and add them to the container listbox + toolbarListBox->clear(); + int current = 0; + int count = 0; + ToolbarTabWidget *tb = ToolbarTabWidget::ref(); + for (int i = 0; i < tb->count(); i++) + { + QString toolbarName = tb->label(i); + QString toolbarId = tb->id(i); + ToolbarEntry *p_toolbar = m_toolbarList[toolbarId]; + if (p_toolbar) + { + QDomNode node = p_toolbar->guiClient->domDocument().firstChild().firstChild().firstChild(); + while (!node.isNull()) + { + if (node.nodeName() == "Action" && + node.toElement().attribute("name") == el.attribute("name")) + { + toolbarListBox->insertItem(toolbarName); + if (item->parent()->text(0) == toolbarName) + current = count; + count++; + } + node = node.nextSibling(); + } + } + } + toolbarListBox->setCurrentItem(current); + toolbarListBox->setSelected(current, true); + toolbarListBox->sort(); + +//set the detailed settings pages to their defaults + lineTag->clear(); + lineClosingTag->clear(); + useClosingTag->setChecked(false); + useActionDialog->setChecked(false); + scriptPath->setText(""); + inputBox->setCurrentItem(0); + outputBox->setCurrentItem(5); + errorBox->setCurrentItem(5); + textEdit->clear(); +//set the detailed settings according to the type of the action + QString type = el.attribute("type", "tag"); + if (type == "tag") + { + QDomElement eltag = el.namedItem("tag").toElement(); + lineTag->setText( eltag.text() ); + useActionDialog->setChecked(eltag.attribute("useDialog","false") == "true"); + eltag = el.namedItem("xtag").toElement(); + lineClosingTag->setText( eltag.text() ); + useClosingTag->setChecked( eltag.attribute("use","false") == "true" ); + typeCombo->setCurrentItem(0); + } + else if (type == "script") + { + QDomElement elScript = el.namedItem("script").toElement(); + scriptPath->setText( elScript.text() ); + + QString s; + s = elScript.attribute("input","none"); + if (s == "current") + { + inputBox->setCurrentItem(1); + } else + if (s == "selected") + { + inputBox->setCurrentItem(2); + } else + { + inputBox->setCurrentItem(0); + } + + s = elScript.attribute("output","none"); + if (s == "cursor") + { + outputBox->setCurrentItem(1); + } else + if (s == "selection") + { + outputBox->setCurrentItem(2); + } else + if (s == "replace") + { + outputBox->setCurrentItem(3); + } else + if (s == "new") + { + outputBox->setCurrentItem(4); + } else + if (s == "message") + { + outputBox->setCurrentItem(5); + } else + { + outputBox->setCurrentItem(0); + } + + s = elScript.attribute("error","none"); + if (s == "cursor") + { + errorBox->setCurrentItem(1); + } else + if (s == "selection") + { + errorBox->setCurrentItem(2); + } else + if (s == "replace") + { + errorBox->setCurrentItem(3); + } else + if (s == "new") + { + errorBox->setCurrentItem(4); + } else + if (s == "message") + { + errorBox->setCurrentItem(5); + } else + { + errorBox->setCurrentItem(0); + } + typeCombo->setCurrentItem(1); + } + else if (type == "text") + { + textEdit->setText( el.namedItem("text").toElement().text() ); + typeCombo->setCurrentItem(2); + } + buttonApply->setEnabled(false); + } + } else + { + actionProperties->setEnabled(false); + deleteAction->setEnabled(false); + } +} + +void ActionConfigDialog::saveCurrentAction() +{ + static_cast<TagAction *>(currentAction)->setModified(true); + QString s; + QDomElement el = static_cast<TagAction *>(currentAction)->data(); + s = actionIcon->icon(); + el.setAttribute("icon", s); + currentAction->setIcon(s); + QString oldText = el.attribute("text"); + s = lineText->text(); + s.replace('&', "&&"); + el.setAttribute("text", s); + currentAction->setText(s); + s = lineToolTip->text(); + el.setAttribute("tooltip", s); + currentAction->setToolTip(s); + s = ""; + if (customShortcut->isChecked()) + { + s = selectedShortcut.toString(); + currentAction->setShortcut(selectedShortcut); + } else + { + currentAction->setShortcut(KShortcut()); + } + el.setAttribute("shortcut", s); + + +//update the tree view + QListViewItem *listItem; + QListViewItemIterator it(actionTreeView); + while (it.current()) + { + listItem = it.current(); + if (listItem->depth() > 0 && listItem->text(2) == currentAction->name()) + { + listItem->setPixmap(0, SmallIcon(actionIcon->icon())); + listItem->setText(0, lineText->text()); + listItem->setText(1, currentAction->shortcut().toString()); + } + ++it; + } + +//remove all the detailed settings + QDomElement item = el.namedItem("tag").toElement(); + if ( !item.isNull() ) + el.removeChild(item); + item = el.namedItem("tag").toElement(); + if ( !item.isNull() ) + el.removeChild(item); + item = el.namedItem("xtag").toElement(); + if ( !item.isNull() ) + el.removeChild(item); + item = el.namedItem("script").toElement(); + if ( !item.isNull() ) + el.removeChild(item); + item = el.namedItem("text").toElement(); + if ( !item.isNull() ) + el.removeChild(item); +//add the new detailed settings + QDomDocument document = QDomDocument(); + int type = typeCombo->currentItem(); + switch (type) + { + case 1:{ + el.setAttribute("type","script"); + item = document.createElement("script"); + switch (inputBox->currentItem()) + { + case 1:{ item.setAttribute("input", "current"); + break; + } + case 2:{ item.setAttribute("input", "selected"); + break; + } + default:{ item.setAttribute("input", "none"); + break; + } + } + switch (outputBox->currentItem()) + { + case 1:{ item.setAttribute("output", "cursor"); + break; + } + case 2:{ item.setAttribute("output", "selection"); + break; + } + case 3:{ item.setAttribute("output", "replace"); + break; + } + case 4:{ item.setAttribute("output", "new"); + break; + } + case 5:{ item.setAttribute("output", "message"); + break; + } + default:{ item.setAttribute("output", "none"); + break; + } + } + switch (errorBox->currentItem()) + { + case 1:{ item.setAttribute("error", "cursor"); + break; + } + case 2:{ item.setAttribute("error", "selection"); + break; + } + case 3:{ item.setAttribute("error", "replace"); + break; + } + case 4:{ item.setAttribute("error", "new"); + break; + } + case 5:{ item.setAttribute("error", "message"); + break; + } + default:{ item.setAttribute("error", "none"); + break; + } + } + + el.appendChild(item); + item.appendChild(document.createTextNode(scriptPath->text())); + break; + } + case 2:{ + el.setAttribute("type","text"); + item = document.createElement("text"); + el.appendChild(item); + item.appendChild(document.createTextNode(textEdit->text())); + break; + } + default:{ + el.setAttribute("type","tag"); + item = document.createElement("tag"); + item.setAttribute("useDialog", useActionDialog->isChecked() ? "true" : "false"); + el.appendChild(item); + item.appendChild(document.createTextNode(lineTag->text())); + item = document.createElement("xtag"); + item.setAttribute("use", useClosingTag->isChecked() ? "true" : "false"); + el.appendChild(item); + item.appendChild(document.createTextNode(lineClosingTag->text())); + break; + } + } + ToolbarTabWidget *tb = ToolbarTabWidget::ref(); + for (int i = 0; i < tb->count(); i++) + { + QString toolbarName = tb->label(i); + QString toolbarId = tb->id(i); + ToolbarEntry *p_toolbar = m_toolbarList[toolbarId]; + bool isOnToolbar = false; + if (p_toolbar) + { + QDomNode node = p_toolbar->guiClient->domDocument().firstChild().firstChild().firstChild(); + bool placeOnToolbar = toolbarListBox->findItem(toolbarName, Qt::ExactMatch); + while (!node.isNull()) + { + if (node.nodeName() == "Action" && + node.toElement().attribute("name") == el.attribute("name")) + { + //if it's present in the toolbar, but not in the container list, + //remove it also from the toolbar + if (!placeOnToolbar) + { + currentAction->unplug(tb->page(i)); + currentAction->unplug(p_toolbar->menu); + node.parentNode().removeChild(node); + QListViewItemIterator iter(actionTreeView); + while (iter.current()) + { + listItem = iter.current(); + if (listItem->depth() > 0 && listItem->parent()->text(0) == toolbarName + && listItem->text(2) == el.attribute("name")) + { + delete listItem; + break; + } + ++iter; + } + } + isOnToolbar = true; + break; + } + node = node.nextSibling(); + } + //it's not on the toolbar, but it should be + if (!isOnToolbar && placeOnToolbar) + { + currentAction->plug(tb->page(i)); + currentAction->plug(p_toolbar->menu); + item = p_toolbar->guiClient->domDocument().createElement("Action"); + item.setAttribute("name",el.attribute("name")); + p_toolbar->guiClient->domDocument().firstChild().firstChild().appendChild(item); + //put it also in the treeview + listItem = actionTreeView->findItem(toolbarName, 0); + if (listItem) + { + QListViewItem *after = listItem->firstChild(); + while ( after && (!after->nextSibling() || (after->nextSibling() && after->nextSibling()->depth()!=0 ) )) + { + if (after->text(2) == currentAction->name()) + { + placeOnToolbar = false; + break; + } + after = after->nextSibling(); + } + if (placeOnToolbar) + { + listItem = new KListViewItem(listItem, after, lineText->text(), currentAction->shortcut().toString(), currentAction->name()); + listItem->setPixmap(0, SmallIcon(actionIcon->icon())); + } + } + } + KXMLGUIFactory::saveConfigFile(p_toolbar->guiClient->domDocument(), + p_toolbar->guiClient->xmlFile(), p_toolbar->guiClient->instance()); + } + QWidget *toolBar = tb->page(i); + if (toolBar->minimumSizeHint().height() > 20) + { + toolBar->adjustSize(); + toolBar->setGeometry(0,0, tb->width(), toolBar->height()); + } else + { + toolBar->setGeometry(0,0, tb->width(), tb->height() - tb->tabHeight()); + } + + } +} + +void ActionConfigDialog::slotShortcutCaptured(const KShortcut &shortcut) +{ + QString shortcutText = shortcut.toString(); + QString shortcutText2; + int pos = shortcutText.find(';'); + if (pos != -1) + { + shortcutText2 = shortcutText.mid(pos + 1); + shortcutText = shortcutText.left(pos); + } + QString s = shortcutText; + s.replace('+', "\\+"); + QRegExp shortcutRx("\\(" + s + "\\)|" + s + "$|" + s + ";"); + s = shortcutText2; + s.replace('+', "\\+"); + QRegExp shortcutRx2("\\(" + s + "\\)|" + s + "$|" + s + ";"); + QString global; +//check for conflicting global shortcuts + QMap<QString, QString>::Iterator it; + for ( it = globalShortcuts.begin(); it != globalShortcuts.end(); ++it ) + { + if (it.data().contains(shortcutRx)) + { + global = it.key(); + break; + } + if (!shortcutText2.isEmpty() && it.data().contains(shortcutRx2)) + { + shortcutText = shortcutText2; + global = it.key(); + break; + } + } + + if (global.isEmpty()) + { + QPtrList<KXMLGUIClient> clients = m_mainWindow->guiFactory()->clients(); + for( QPtrListIterator<KXMLGUIClient> it( clients ); it.current(); ++it ) + { + KActionCollection *ac = (*it)->actionCollection(); + for (uint i = 0; i < ac->count(); i++) + { + KAction *action = ac->action(i); + if (action != currentAction && action->shortcut().toString().contains(shortcutRx)) + { + global = action->text(); + break; + } + if (!shortcutText2.isEmpty() && action != currentAction && action->shortcut().toString().contains(shortcutRx)) + { + shortcutText = shortcutText2; + global = action->text(); + break; + } + } + if (!global.isEmpty()) + break; + } + } + + if (global.isEmpty()) + { + shortcutKeyButton->setText(shortcutText); + buttonApply->setEnabled(true); + selectedShortcut = shortcut; + } else + { + global.replace('&',""); + QString s = i18n("The '%1' key combination has already been allocated " + "to the \"%2\" action.\n" + "Please choose a unique key combination."). + arg(shortcutText).arg(global); + KMessageBox::sorry( this, s, i18n("Conflicting Shortcuts")); + } +} + +void ActionConfigDialog::accept() +{ + if (buttonApply->isEnabled()) + saveCurrentAction(); + ActionConfigDialogS::accept(); +} + +void ActionConfigDialog::reject() +{ + if (buttonApply->isEnabled() && KMessageBox::questionYesNo(this, i18n("Do you want to save the changes made to this action?"), QString::null, KStdGuiItem::save(), KStdGuiItem::discard()) == KMessageBox::Yes ) + saveCurrentAction(); + ActionConfigDialogS::reject(); +} + +void ActionConfigDialog::slotNewAction() +{ + QDomDocument doc; + QDomElement el = doc.createElement("action"); + el.setAttribute( "name", "user_"+KApplication::randomString(10) ); + el.setAttribute( "icon", "ball" ); + + currentAction = new TagAction(&el, m_mainWindow); + + //add the actions to every toolbar xmlguiclient + QDictIterator<ToolbarEntry> it(m_toolbarList); + while (it.current()) + { + it.current()->guiClient->actionCollection()->insert(currentAction); + ++it; + } + + selectedShortcut = KShortcut(); + static_cast<TagAction*>(currentAction)->setModified(true); + QListViewItem *currentItem = actionTreeView->currentItem(); + QListViewItem *item = new KListViewItem(allActionsItem); + QString actionText = QString("Action_%1").arg(m_mainWindow->actionCollection()->count()); + currentAction->setText(actionText); + item->setText(2, currentAction->name()); + item->setText(0, actionText); + item->setPixmap(0, SmallIcon("ball")); + allActionsItem->sortChildItems(0, true); + if (currentItem->parent() && currentItem->parent() == allActionsItem) + { + actionTreeView->setCurrentItem(item); + } else + { + QListViewItem *parentItem = currentItem->parent(); + if (!parentItem) + parentItem = currentItem; + + item = new KListViewItem(parentItem, currentItem); + item->setText(0, actionText); + item->setText(2, currentAction->name()); + item->setPixmap(0, SmallIcon("ball")); + actionTreeView->setCurrentItem(item); + if (parentItem != allActionsItem) + { + toolbarListBox->insertItem(parentItem->text(0)); + toolbarListBox->setCurrentItem(0); + toolbarListBox->setSelected(0, true); + } + } + actionTreeView->ensureItemVisible(item); + buttonApply->setEnabled(true); +} + +void ActionConfigDialog::slotDeleteAction() +{ + if ( KMessageBox::warningContinueCancel(this, i18n("<qt>Removing the action removes all the references to it.\nAre you sure you want to remove the <b>%1</b> action?</qt>").arg(currentAction->text()),QString::null,KStdGuiItem::del()) == KMessageBox::Continue ) + { + QString actionName = currentAction->name(); + emit deleteUserAction(currentAction); + currentAction = 0L; + //update the tree view + QListViewItem *listItem; + QListViewItemIterator it(actionTreeView); + while (it.current()) + { + listItem = it.current(); + if (listItem->depth() > 0 && listItem->text(2) == actionName) + { + ++it; + delete listItem; + } else + { + ++it; + } + } + slotSelectionChanged(actionTreeView->currentItem()); + } +} + +void ActionConfigDialog::slotApply() +{ + saveCurrentAction(); + buttonApply->setEnabled(false); +} + +void ActionConfigDialog::slotAddContainerToolbar() +{ + ToolbarTabWidget *tb = ToolbarTabWidget::ref(); + int i; + + QStringList lst; + for (i = 0; i < tb->count(); i++) + { + if (!toolbarListBox->findItem(tb->label(i), Qt::ExactMatch)) + lst << tb->label(i); + } + + if (lst.count() > 0) + { + bool ok = false; + QString res = KInputDialog::getItem( + i18n( "Add Action to Toolbar" ), + i18n( "Please select a toolbar:" ), lst, 0, false, &ok, this ); + + if (ok) + { + toolbarListBox->insertItem(res); + toolbarListBox->sort(); + buttonApply->setEnabled(true); + } + } +} + +void ActionConfigDialog::slotRemoveContainerToolbar() +{ + int item = toolbarListBox->currentItem(); + toolbarListBox->removeItem(item); + item = (item > 0) ? item - 1 : 0; + toolbarListBox->setCurrentItem(item); + toolbarListBox->setSelected(item, true); + buttonApply->setEnabled(true); +} + +void ActionConfigDialog::slotToggled(bool) +{ + buttonApply->setEnabled(true); +} + +void ActionConfigDialog::slotTextChanged() +{ + buttonApply->setEnabled(true); +} + +void ActionConfigDialog::slotTextChanged(const QString&) +{ + buttonApply->setEnabled(true); +} + +void ActionConfigDialog::createScriptAction(const QString& a_name, const QString& a_script) +{ + actionTreeView->setCurrentItem(allActionsItem); + slotNewAction(); + typeCombo->setCurrentItem(1); + scriptPath->setText(a_script); + lineText->setText(a_name); +} + +#include "actionconfigdialog.moc" diff --git a/quanta/dialogs/actionconfigdialog.h b/quanta/dialogs/actionconfigdialog.h new file mode 100644 index 00000000..f94ba67e --- /dev/null +++ b/quanta/dialogs/actionconfigdialog.h @@ -0,0 +1,92 @@ +/*************************************************************************** + actionconfigdialog.cpp + --------------------- + copyright : (C) 2003 by Andras Mantia <amantia@kde.org> + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; version 2 of the License. * + * * + ***************************************************************************/ + +#ifndef ACTIONCONFIGDIALOG_H +#define ACTIONCONFIGDIALOG_H + +#include <qmap.h> +#include "actionconfigdialogs.h" + +class QDomDocument; +class QPopupMenu; + +class KAction; +class KMainWindow; +class KPopupMenu; +class KShortcut; +class KXMLGUIClient; + +typedef struct ToolbarEntry{ + KXMLGUIClient *guiClient; + QDomDocument *dom; + QPopupMenu *menu; + KURL url; + QString name; + QString id; + bool user; + bool visible; + bool nameModified; ///< True if the name of the toolbar was modified by Quanta on loading:" (n)" was added +}; + +class ActionConfigDialog: public ActionConfigDialogS +{ + Q_OBJECT + +public: + + ActionConfigDialog(const QDict<ToolbarEntry> &toolbarList, KMainWindow* parent = 0, const char* name = 0, bool modal = true, WFlags fl = 0 , const QString& defaultAction = QString::null); + ~ActionConfigDialog(); + void createScriptAction(const QString& a_name, const QString& a_script); + +public slots: + virtual void accept(); + virtual void reject(); + void slotToggled(bool); + void slotTextChanged(); + void slotTextChanged(const QString&); + void slotNewAction(); + +private slots: + void slotAddToolbar(); + void slotRemoveToolbar(); + void slotEditToolbar(); + void slotContextMenu(KListView *,QListViewItem *,const QPoint &); + void slotSelectionChanged(QListViewItem *); + void slotShortcutCaptured(const KShortcut&); + void slotDeleteAction(); + void slotApply(); + void slotAddContainerToolbar(); + void slotRemoveContainerToolbar(); + void slotToolbarRemoved(const QString& toolbarName); + +signals: + void addToolbar(); + void removeToolbar(const QString&); + void deleteUserAction(KAction *); + void configureToolbars(const QString&); + +private: + void saveCurrentAction(); + + KPopupMenu *treeMenu; + KAction *currentAction; + QListViewItem *allActionsItem; + QMap<QString, QString> globalShortcuts; + KShortcut selectedShortcut; + KMainWindow *m_mainWindow; + QDict<ToolbarEntry> m_toolbarList; + QListViewItem *m_toolbarItem; +}; + +#endif diff --git a/quanta/dialogs/actionconfigdialogs.ui b/quanta/dialogs/actionconfigdialogs.ui new file mode 100644 index 00000000..baeb41bd --- /dev/null +++ b/quanta/dialogs/actionconfigdialogs.ui @@ -0,0 +1,1001 @@ +<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> +<class>ActionConfigDialogS</class> +<comment>A dialog box where you can configure the actions and the toolbars holding the actions. + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; version 2 of the License. * + * * + ***************************************************************************/ +</comment> +<author>Andras Mantia <amantia@kde.org></author> +<widget class="QDialog"> + <property name="name"> + <cstring>ActionConfigDialogS</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>751</width> + <height>628</height> + </rect> + </property> + <property name="caption"> + <string>Configure Actions</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QSplitter" row="0" column="0"> + <property name="name"> + <cstring>splitter2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout17</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KPushButton" row="2" column="3"> + <property name="name"> + <cstring>deleteAction</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>&Delete Action</string> + </property> + </widget> + <widget class="QPushButton" row="2" column="1"> + <property name="name"> + <cstring>addAction</cstring> + </property> + <property name="text"> + <string>&New Action</string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + </widget> + <spacer row="2" column="2"> + <property name="name"> + <cstring>spacer14</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>16</width> + <height>20</height> + </size> + </property> + </spacer> + <spacer row="1" column="4"> + <property name="name"> + <cstring>spacer17</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Fixed</enum> + </property> + <property name="sizeHint"> + <size> + <width>16</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QLabel" row="0" column="0" rowspan="1" colspan="4"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Toolbar & Action Tree</string> + </property> + </widget> + <widget class="KListView" row="1" column="1" rowspan="1" colspan="3"> + <column> + <property name="text"> + <string>Name</string> + </property> + <property name="clickable"> + <bool>false</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>Shortcut</string> + </property> + <property name="clickable"> + <bool>false</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>actionTreeView</cstring> + </property> + <property name="hScrollBarMode"> + <enum>Auto</enum> + </property> + <property name="rootIsDecorated"> + <bool>true</bool> + </property> + <property name="resizeMode"> + <enum>AllColumns</enum> + </property> + <property name="tooltipColumn"> + <number>2</number> + </property> + </widget> + </grid> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout9</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KPushButton" row="1" column="3"> + <property name="name"> + <cstring>buttonApply</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>&Apply</string> + </property> + </widget> + <widget class="QPushButton" row="1" column="4"> + <property name="name"> + <cstring>buttonCancel</cstring> + </property> + <property name="text"> + <string>&Cancel</string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + </widget> + <spacer row="0" column="0"> + <property name="name"> + <cstring>spacer16</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Fixed</enum> + </property> + <property name="sizeHint"> + <size> + <width>16</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="KPushButton" row="1" column="2"> + <property name="name"> + <cstring>buttonOk</cstring> + </property> + <property name="minimumSize"> + <size> + <width>90</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>&OK</string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + <widget class="QButtonGroup" row="0" column="1" rowspan="1" colspan="4"> + <property name="name"> + <cstring>actionProperties</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="title"> + <string>Action Properties</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QPushButton" row="6" column="3" rowspan="1" colspan="2"> + <property name="name"> + <cstring>addToolbar</cstring> + </property> + <property name="text"> + <string>&Add...</string> + </property> + </widget> + <widget class="QPushButton" row="7" column="3" rowspan="1" colspan="2"> + <property name="name"> + <cstring>removeToolbar</cstring> + </property> + <property name="text"> + <string>&Remove</string> + </property> + </widget> + <spacer row="6" column="0" rowspan="2" colspan="1"> + <property name="name"> + <cstring>spacer7</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Fixed</enum> + </property> + <property name="sizeHint"> + <size> + <width>16</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QLabel" row="2" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>TextLabel2</cstring> + </property> + <property name="text"> + <string>Tool &tip:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>lineToolTip</cstring> + </property> + </widget> + <widget class="QLineEdit" row="2" column="2" rowspan="1" colspan="3"> + <property name="name"> + <cstring>lineToolTip</cstring> + </property> + </widget> + <widget class="QLabel" row="1" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>TextLabel1_2</cstring> + </property> + <property name="text"> + <string>Te&xt:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>lineText</cstring> + </property> + </widget> + <widget class="KIconButton" row="1" column="4"> + <property name="name"> + <cstring>actionIcon</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>32</width> + <height>32</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>32</width> + <height>32</height> + </size> + </property> + <property name="text"> + <string></string> + </property> + <property name="iconSize"> + <number>22</number> + </property> + </widget> + <widget class="QLineEdit" row="1" column="2" rowspan="1" colspan="2"> + <property name="name"> + <cstring>lineText</cstring> + </property> + </widget> + <widget class="QButtonGroup" row="4" column="0" rowspan="1" colspan="5"> + <property name="name"> + <cstring>buttonGroup4_2</cstring> + </property> + <property name="title"> + <string>Shortcut</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QRadioButton" row="0" column="1"> + <property name="name"> + <cstring>customShortcut</cstring> + </property> + <property name="text"> + <string>C&ustom</string> + </property> + </widget> + <widget class="KKeyButton" row="0" column="2"> + <property name="name"> + <cstring>shortcutKeyButton</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>None</string> + </property> + </widget> + <widget class="QRadioButton" row="0" column="0"> + <property name="name"> + <cstring>noShortcut</cstring> + </property> + <property name="text"> + <string>&None</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </grid> + </widget> + <widget class="KListBox" row="6" column="1" rowspan="2" colspan="2"> + <property name="name"> + <cstring>toolbarListBox</cstring> + </property> + </widget> + <widget class="QLabel" row="5" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>textLabel2</cstring> + </property> + <property name="text"> + <string>Container toolbars:</string> + </property> + </widget> + <widget class="QComboBox" row="0" column="2" rowspan="1" colspan="3"> + <item> + <property name="text"> + <string>Tag</string> + </property> + </item> + <item> + <property name="text"> + <string>Script</string> + </property> + </item> + <item> + <property name="text"> + <string>Text</string> + </property> + </item> + <property name="name"> + <cstring>typeCombo</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="QLabel" row="0" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>textLabel3</cstring> + </property> + <property name="text"> + <string>T&ype:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>typeCombo</cstring> + </property> + </widget> + <widget class="QButtonGroup" row="8" column="0" rowspan="1" colspan="5"> + <property name="name"> + <cstring>buttonGroup13</cstring> + </property> + <property name="title"> + <string>Detailed Settings</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QWidgetStack" row="0" column="0"> + <property name="name"> + <cstring>widgetStack1</cstring> + </property> + <widget class="QWidget"> + <property name="name"> + <cstring>page</cstring> + </property> + <attribute name="id"> + <number>0</number> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>TextLabel5_2_2_2</cstring> + </property> + <property name="text"> + <string><tag> :</string> + </property> + </widget> + <widget class="QLineEdit" row="0" column="1"> + <property name="name"> + <cstring>lineTag</cstring> + </property> + </widget> + <widget class="QLineEdit" row="1" column="1"> + <property name="name"> + <cstring>lineClosingTag</cstring> + </property> + </widget> + <widget class="QCheckBox" row="1" column="0"> + <property name="name"> + <cstring>useClosingTag</cstring> + </property> + <property name="text"> + <string></tag> :</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="QCheckBox" row="2" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>useActionDialog</cstring> + </property> + <property name="text"> + <string>Run "Edit tag" dialog if available</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>page</cstring> + </property> + <attribute name="id"> + <number>1</number> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="FileCombo" row="0" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>scriptPath</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>64</width> + <height>20</height> + </size> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>textLabel1_2</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>&Input:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>inputBox</cstring> + </property> + </widget> + <widget class="QComboBox" row="1" column="1"> + <item> + <property name="text"> + <string>None</string> + </property> + </item> + <item> + <property name="text"> + <string>Current Document</string> + </property> + </item> + <item> + <property name="text"> + <string>Selected Text</string> + </property> + </item> + <property name="name"> + <cstring>inputBox</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>textLabel2_2</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>&Output:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>outputBox</cstring> + </property> + </widget> + <widget class="QComboBox" row="2" column="1"> + <item> + <property name="text"> + <string>None</string> + </property> + </item> + <item> + <property name="text"> + <string>Insert in Cursor Position</string> + </property> + </item> + <item> + <property name="text"> + <string>Replace Selection</string> + </property> + </item> + <item> + <property name="text"> + <string>Replace Current Document</string> + </property> + </item> + <item> + <property name="text"> + <string>Create New Document</string> + </property> + </item> + <item> + <property name="text"> + <string>Message Window</string> + </property> + </item> + <property name="name"> + <cstring>outputBox</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="currentItem"> + <number>5</number> + </property> + </widget> + <widget class="QComboBox" row="3" column="1"> + <item> + <property name="text"> + <string>None</string> + </property> + </item> + <item> + <property name="text"> + <string>Insert in cursor position</string> + </property> + </item> + <item> + <property name="text"> + <string>Replace selection</string> + </property> + </item> + <item> + <property name="text"> + <string>Replace current document</string> + </property> + </item> + <item> + <property name="text"> + <string>Create a new document</string> + </property> + </item> + <item> + <property name="text"> + <string>Message window</string> + </property> + </item> + <property name="name"> + <cstring>errorBox</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="currentItem"> + <number>5</number> + </property> + </widget> + <widget class="QLabel" row="3" column="0"> + <property name="name"> + <cstring>textLabel3_2</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>&Error:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>errorBox</cstring> + </property> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>page</cstring> + </property> + <attribute name="id"> + <number>2</number> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QMultiLineEdit" row="0" column="0"> + <property name="name"> + <cstring>textEdit</cstring> + </property> + </widget> + </grid> + </widget> + </widget> + </grid> + </widget> + </grid> + </widget> + <spacer row="1" column="1"> + <property name="name"> + <cstring>spacer15</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>55</width> + <height>20</height> + </size> + </property> + </spacer> + </grid> + </widget> + </widget> + </grid> +</widget> +<customwidgets> + <customwidget> + <class>FileCombo</class> + <header location="global">filecombo.h</header> + <sizehint> + <width>-1</width> + <height>-1</height> + </sizehint> + <container>0</container> + <sizepolicy> + <hordata>5</hordata> + <verdata>5</verdata> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + <pixmap>image0</pixmap> + <slot access="public" specifier="">slotFileSelect()</slot> + <property type="String">text</property> + </customwidget> +</customwidgets> +<images> + <image name="image0"> + <data format="PNG" length="339">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000011a494441541895d595318ac3301045bf1617ba860c7b83ade6186149b104f6762952e418aa72838551b324e9d2aa3028852c90a3911c9c75b1bf195bd85f6ffe085b596bb186de56715dd3b87be621220af9bdb556cdbd334b9c4c7333220a69fd71d324d51a1e110589ee990e9ac4b596ff240a49b5f67315512c1994a4c9a920a2100e5fc0c7262e9c8e500dbad6a6e5714ba6e37538d4a95465b8b2717aa9ffac3b66caa3cb37918d4f470000334343c3c3cfd6beefe789d5760f66c6e57a010640771a7ef070cec11833a900b0fbde157997c76da4d5d0b17691c83907f36e26b5a5c2586df738f319eed7c536070ff73312663549a295898198dd42d2a4226366c6ed7a9b662a90b66845e3c7e92e55f3ebf68afedfafe90ee225a4cc1198386d0000000049454e44ae426082</data> + </image> +</images> +<connections> + <connection> + <sender>typeCombo</sender> + <signal>activated(int)</signal> + <receiver>widgetStack1</receiver> + <slot>raiseWidget(int)</slot> + </connection> + <connection> + <sender>customShortcut</sender> + <signal>toggled(bool)</signal> + <receiver>shortcutKeyButton</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>buttonCancel</sender> + <signal>clicked()</signal> + <receiver>ActionConfigDialogS</receiver> + <slot>reject()</slot> + </connection> + <connection> + <sender>buttonOk</sender> + <signal>clicked()</signal> + <receiver>ActionConfigDialogS</receiver> + <slot>accept()</slot> + </connection> + <connection> + <sender>typeCombo</sender> + <signal>highlighted(int)</signal> + <receiver>widgetStack1</receiver> + <slot>raiseWidget(int)</slot> + </connection> + <connection> + <sender>useClosingTag</sender> + <signal>toggled(bool)</signal> + <receiver>lineClosingTag</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>addAction</sender> + <signal>clicked()</signal> + <receiver>ActionConfigDialogS</receiver> + <slot>slotNewAction()</slot> + </connection> + <connection> + <sender>deleteAction</sender> + <signal>clicked()</signal> + <receiver>ActionConfigDialogS</receiver> + <slot>slotDeleteAction()</slot> + </connection> + <connection> + <sender>addToolbar</sender> + <signal>clicked()</signal> + <receiver>ActionConfigDialogS</receiver> + <slot>slotAddContainerToolbar()</slot> + </connection> + <connection> + <sender>removeToolbar</sender> + <signal>clicked()</signal> + <receiver>ActionConfigDialogS</receiver> + <slot>slotRemoveContainerToolbar()</slot> + </connection> + <connection> + <sender>buttonApply</sender> + <signal>clicked()</signal> + <receiver>ActionConfigDialogS</receiver> + <slot>slotApply()</slot> + </connection> + <connection> + <sender>lineText</sender> + <signal>textChanged(const QString&)</signal> + <receiver>ActionConfigDialogS</receiver> + <slot>slotTextChanged(const QString&)</slot> + </connection> + <connection> + <sender>lineTag</sender> + <signal>textChanged(const QString&)</signal> + <receiver>ActionConfigDialogS</receiver> + <slot>slotTextChanged(const QString&)</slot> + </connection> + <connection> + <sender>lineClosingTag</sender> + <signal>textChanged(const QString&)</signal> + <receiver>ActionConfigDialogS</receiver> + <slot>slotTextChanged(const QString&)</slot> + </connection> + <connection> + <sender>textEdit</sender> + <signal>textChanged()</signal> + <receiver>ActionConfigDialogS</receiver> + <slot>slotTextChanged()</slot> + </connection> + <connection> + <sender>customShortcut</sender> + <signal>toggled(bool)</signal> + <receiver>ActionConfigDialogS</receiver> + <slot>slotToggled(bool)</slot> + </connection> + <connection> + <sender>noShortcut</sender> + <signal>toggled(bool)</signal> + <receiver>ActionConfigDialogS</receiver> + <slot>slotToggled(bool)</slot> + </connection> + <connection> + <sender>useClosingTag</sender> + <signal>toggled(bool)</signal> + <receiver>ActionConfigDialogS</receiver> + <slot>slotToggled(bool)</slot> + </connection> + <connection> + <sender>useActionDialog</sender> + <signal>toggled(bool)</signal> + <receiver>ActionConfigDialogS</receiver> + <slot>slotToggled(bool)</slot> + </connection> + <connection> + <sender>actionIcon</sender> + <signal>toggled(bool)</signal> + <receiver>ActionConfigDialogS</receiver> + <slot>slotToggled(bool)</slot> + </connection> + <connection> + <sender>lineToolTip</sender> + <signal>textChanged(const QString&)</signal> + <receiver>ActionConfigDialogS</receiver> + <slot>slotTextChanged(const QString&)</slot> + </connection> + <connection> + <sender>typeCombo</sender> + <signal>activated(const QString&)</signal> + <receiver>ActionConfigDialogS</receiver> + <slot>slotTextChanged(const QString&)</slot> + </connection> + <connection> + <sender>inputBox</sender> + <signal>activated(const QString&)</signal> + <receiver>ActionConfigDialogS</receiver> + <slot>slotTextChanged(const QString&)</slot> + </connection> + <connection> + <sender>outputBox</sender> + <signal>activated(const QString&)</signal> + <receiver>ActionConfigDialogS</receiver> + <slot>slotTextChanged(const QString&)</slot> + </connection> + <connection> + <sender>errorBox</sender> + <signal>activated(const QString&)</signal> + <receiver>ActionConfigDialogS</receiver> + <slot>slotTextChanged(const QString&)</slot> + </connection> + <connection> + <sender>shortcutKeyButton</sender> + <signal>toggled(bool)</signal> + <receiver>ActionConfigDialogS</receiver> + <slot>slotToggled(bool)</slot> + </connection> + <connection> + <sender>customShortcut</sender> + <signal>clicked()</signal> + <receiver>shortcutKeyButton</receiver> + <slot>animateClick()</slot> + </connection> + <connection> + <sender>actionIcon</sender> + <signal>clicked()</signal> + <receiver>ActionConfigDialogS</receiver> + <slot>slotTextChanged()</slot> + </connection> +</connections> +<tabstops> + <tabstop>actionTreeView</tabstop> + <tabstop>addAction</tabstop> + <tabstop>deleteAction</tabstop> + <tabstop>typeCombo</tabstop> + <tabstop>lineText</tabstop> + <tabstop>actionIcon</tabstop> + <tabstop>lineToolTip</tabstop> + <tabstop>noShortcut</tabstop> + <tabstop>shortcutKeyButton</tabstop> + <tabstop>toolbarListBox</tabstop> + <tabstop>addToolbar</tabstop> + <tabstop>removeToolbar</tabstop> + <tabstop>lineTag</tabstop> + <tabstop>useClosingTag</tabstop> + <tabstop>lineClosingTag</tabstop> + <tabstop>useActionDialog</tabstop> + <tabstop>inputBox</tabstop> + <tabstop>outputBox</tabstop> + <tabstop>errorBox</tabstop> + <tabstop>textEdit</tabstop> + <tabstop>buttonOk</tabstop> + <tabstop>buttonApply</tabstop> + <tabstop>buttonCancel</tabstop> +</tabstops> +<includes> + <include location="global" impldecl="in implementation">kkeybutton.h</include> + <include location="global" impldecl="in implementation">kpushbutton.h</include> +</includes> +<slots> + <slot>buttonOk_clicked()</slot> + <slot>slotNewAction()</slot> + <slot>slotDeleteAction()</slot> + <slot>slotAddContainerToolbar()</slot> + <slot>slotRemoveContainerToolbar()</slot> + <slot>slotApply()</slot> + <slot>lineText_selectionChanged()</slot> + <slot>typeCombo_activated(const QString&)</slot> + <slot>slotTextChanged(const QString&)</slot> + <slot>shortcutKeyButton_toggled(bool)</slot> + <slot>slotToggled(bool)</slot> + <slot>slotTextChanged()</slot> +</slots> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>klistview.h</includehint> + <includehint>kicondialog.h</includehint> + <includehint>kkeybutton.h</includehint> + <includehint>klistbox.h</includehint> + <includehint>filecombo.h</includehint> +</includehints> +</UI> diff --git a/quanta/dialogs/casewidget.ui b/quanta/dialogs/casewidget.ui new file mode 100644 index 00000000..f7f064f9 --- /dev/null +++ b/quanta/dialogs/casewidget.ui @@ -0,0 +1,108 @@ +<!DOCTYPE UI><UI version="3.1" stdsetdef="1"> +<class>CaseWidget</class> +<widget class="QWidget"> + <property name="name"> + <cstring>CaseWidget</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>500</width> + <height>158</height> + </rect> + </property> + <property name="minimumSize"> + <size> + <width>500</width> + <height>100</height> + </size> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QButtonGroup" row="0" column="0"> + <property name="name"> + <cstring>buttonGroup2</cstring> + </property> + <property name="title"> + <string>Tag Case</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QRadioButton" row="0" column="0"> + <property name="name"> + <cstring>upperTag</cstring> + </property> + <property name="text"> + <string>Upper case</string> + </property> + </widget> + <widget class="QRadioButton" row="1" column="0"> + <property name="name"> + <cstring>lowerTag</cstring> + </property> + <property name="text"> + <string>Lower case</string> + </property> + </widget> + <widget class="QRadioButton" row="2" column="0"> + <property name="name"> + <cstring>unchangedTag</cstring> + </property> + <property name="text"> + <string>Unchanged</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </grid> + </widget> + <widget class="QButtonGroup" row="0" column="1"> + <property name="name"> + <cstring>buttonGroup3</cstring> + </property> + <property name="title"> + <string>Attribute Case</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QRadioButton" row="0" column="0"> + <property name="name"> + <cstring>upperAttr</cstring> + </property> + <property name="text"> + <string>Upper case</string> + </property> + </widget> + <widget class="QRadioButton" row="1" column="0"> + <property name="name"> + <cstring>lowerAttr</cstring> + </property> + <property name="text"> + <string>Lower case</string> + </property> + </widget> + <widget class="QRadioButton" row="2" column="0"> + <property name="name"> + <cstring>unchangedAttr</cstring> + </property> + <property name="text"> + <string>Unchanged</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </grid> + </widget> + </grid> +</widget> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/quanta/dialogs/copyto.cpp b/quanta/dialogs/copyto.cpp new file mode 100644 index 00000000..429fa457 --- /dev/null +++ b/quanta/dialogs/copyto.cpp @@ -0,0 +1,127 @@ +/*************************************************************************** + copytodlg.cpp - description + ------------------- + begin : Mon Mar 27 2000 + copyright : (C) 2000 by Yacovlev Alexander & Dmitry Poplavsky <dima@mail.univ.kiev.ua> + (C) 2001-2002 Andras Mantia <amantia@kde.org> + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +// qt includes + +// kde includes +#include <kio/job.h> +#include <kio/netaccess.h> + +//app includes +#include "copyto.h" +#include "qextfileinfo.h" + +CopyTo::CopyTo(const KURL& dirURL) +{ + m_InitialDirUrl = dirURL; +} + +CopyTo::~CopyTo(){ +} + +KURL CopyTo::copy(const KURL& urlToCopy, const KURL& destination) +{ + m_destList.clear(); + KURL targetDirURL = KURL(); + if ( destination.isEmpty() ) + { + targetDirURL = m_InitialDirUrl; + } else + { + targetDirURL = destination; + } + targetDirURL.adjustPath(1); + + bool doCopy = true; + if (!QExtFileInfo::exists(targetDirURL, false, 0L)) + { + doCopy = QExtFileInfo::createDir(targetDirURL, 0L); + } + + KURL destURL; + if (doCopy) + { + KIO::UDSEntry entry; + KIO::NetAccess::stat(urlToCopy, entry, 0); + KFileItem item(entry, urlToCopy, false, true); + destURL = targetDirURL; + destURL.setPath(destURL.path(1) + urlToCopy.fileName(false)); + if (item.isDir()) + destURL.adjustPath(1); + + KIO::CopyJob *job = KIO::copy(urlToCopy, destURL, true); + connect( job, SIGNAL(result( KIO::Job *)), + SLOT (slotResult( KIO::Job *))); + + QString path = destURL.path(); + if (path != "." && path != "..") + m_destList.append(destURL); + } + + return destURL; +} + +void CopyTo::slotResult( KIO::Job *) +{ + emit addFilesToProject(m_destList); + emit deleteDialog(this); +} + +KURL::List CopyTo::copy(const KURL::List& sourceList, const KURL& destination ) +{ + m_listCopy = true; + m_destList.clear(); + KURL targetDirURL = KURL(); + if ( destination.isEmpty() ) + { + targetDirURL = m_InitialDirUrl; + } else + { + targetDirURL = destination; + } + bool doCopy = true; + if (!QExtFileInfo::exists(targetDirURL, false, 0L)) + { + doCopy = QExtFileInfo::createDir(targetDirURL, 0L); + } + + KIO::UDSEntry entry; + if (doCopy) + { + QString path; + for (uint i = 0; i < sourceList.count(); i++) + { + KURL srcURL = sourceList[i]; + KIO::NetAccess::stat(srcURL, entry, 0); + KFileItem item(entry, srcURL, false, true); + KURL u = targetDirURL; + u.setPath(targetDirURL.path(1) + srcURL.fileName()); + if (item.isDir()) + u.adjustPath(1); + path = u.path(); + if (path != "." && path != "..") + m_destList.append(u); + } + + KIO::CopyJob *job = KIO::copy(sourceList, targetDirURL, true); + connect( job, SIGNAL(result( KIO::Job *)), + SLOT (slotResult( KIO::Job *))); + } + + return m_destList; + +} +#include "copyto.moc" diff --git a/quanta/dialogs/copyto.h b/quanta/dialogs/copyto.h new file mode 100644 index 00000000..452919aa --- /dev/null +++ b/quanta/dialogs/copyto.h @@ -0,0 +1,53 @@ +/*************************************************************************** + copytodlg.h - description + ------------------- + begin : Mon Mar 27 2000 + copyright : (C) 2000 by Yacovlev Alexander & Dmitry Poplavsky <dima@mail.univ.kiev.ua> + (C) 2001-2003 by Andras Mantia + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef COPYTO_H +#define COPYTO_H + +// kde includes +#include <kio/jobclasses.h> + + +/** + *@author Yacovlev Alexander & Dmitry Poplavsky + */ + +class KURL; + +class CopyTo : public QObject{ +Q_OBJECT +public: + CopyTo(const KURL& dirURL); + ~CopyTo(); + + KURL copy( const KURL& sourceURL, const KURL &destination); + KURL::List copy(const KURL::List& sourceList, const KURL &destination ); + +public slots: // Public slots + void slotResult( KIO::Job *); + +signals: + void addFilesToProject(const KURL::List&); + void deleteDialog(CopyTo*); + +private: + KURL m_InitialDirUrl; + bool m_listCopy; + KURL::List m_destList; +}; + +#endif diff --git a/quanta/dialogs/debuggeroptionss.ui b/quanta/dialogs/debuggeroptionss.ui new file mode 100644 index 00000000..8e1910f4 --- /dev/null +++ b/quanta/dialogs/debuggeroptionss.ui @@ -0,0 +1,141 @@ +<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> +<class>DebuggerOptionsS</class> +<widget class="QWidget"> + <property name="name"> + <cstring>DebuggerOptionsS</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>350</width> + <height>220</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>3</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>350</width> + <height>220</height> + </size> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QCheckBox" row="0" column="0"> + <property name="name"> + <cstring>checkDebugger</cstring> + </property> + <property name="text"> + <string>Enable debugger</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="QButtonGroup" row="1" column="0"> + <property name="name"> + <cstring>ButtonGroup1</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string></string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QRadioButton" row="0" column="0"> + <property name="name"> + <cstring>radioPhp3</cstring> + </property> + <property name="text"> + <string>PHP3 listener</string> + </property> + </widget> + <widget class="QRadioButton" row="1" column="0"> + <property name="name"> + <cstring>radioPhp4</cstring> + </property> + <property name="text"> + <string>PHP4 debugger</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <spacer row="0" column="1" rowspan="2" colspan="1"> + <property name="name" stdset="0"> + <cstring>Spacer6</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </grid> + </widget> + <spacer row="2" column="0"> + <property name="name" stdset="0"> + <cstring>Spacer2</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </grid> +</widget> +<connections> + <connection> + <sender>checkDebugger</sender> + <signal>toggled(bool)</signal> + <receiver>ButtonGroup1</receiver> + <slot>setEnabled(bool)</slot> + </connection> +</connections> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/quanta/dialogs/dirtydialog.ui b/quanta/dialogs/dirtydialog.ui new file mode 100644 index 00000000..3d46130e --- /dev/null +++ b/quanta/dialogs/dirtydialog.ui @@ -0,0 +1,154 @@ +<!DOCTYPE UI><UI version="3.1" stdsetdef="1"> +<class>DirtyDialog</class> +<comment>/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; version 2 of the License. * + * * + ***************************************************************************/ +</comment> +<author>(C) 2002 Andras Mantia <amantia@kde.org></author> +<widget class="QWidget"> + <property name="name"> + <cstring>DirtyDialog</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>609</width> + <height>288</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>400</width> + <height>220</height> + </size> + </property> + <property name="caption"> + <string>File Changed</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>The file was changed outside of the Quanta editor.</string> + </property> + </widget> + <widget class="QButtonGroup" row="1" column="0"> + <property name="name"> + <cstring>ButtonGroup2</cstring> + </property> + <property name="title"> + <string> How Do You Want to Proceed?</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QRadioButton" row="2" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>buttonIgnore</cstring> + </property> + <property name="text"> + <string>&Do not load the modified version from disk</string> + </property> + </widget> + <widget class="QRadioButton" row="1" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>buttonLoad</cstring> + </property> + <property name="text"> + <string>&Use the version from disk (will lose the current content)</string> + </property> + </widget> + <widget class="QLabel" row="3" column="1"> + <property name="name"> + <cstring>warningLabel</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>(If you later save the document, you will lose what was on the disk.)</string> + </property> + <property name="alignment"> + <set>WordBreak|AlignVCenter</set> + </property> + </widget> + <spacer row="3" column="0"> + <property name="name"> + <cstring>Spacer2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Fixed</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QRadioButton" row="0" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>buttonCompare</cstring> + </property> + <property name="text"> + <string>&Compare the two versions and load the result</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="toolTip" stdset="0"> + <string>Use Kompare if available. Otherwise this checkbox is disabled.</string> + </property> + </widget> + </grid> + </widget> + </grid> +</widget> +<tabstops> + <tabstop>buttonCompare</tabstop> + <tabstop>buttonIgnore</tabstop> + <tabstop>buttonLoad</tabstop> +</tabstops> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/quanta/dialogs/dirtydlg.cpp b/quanta/dialogs/dirtydlg.cpp new file mode 100644 index 00000000..ad9e408b --- /dev/null +++ b/quanta/dialogs/dirtydlg.cpp @@ -0,0 +1,112 @@ +/*************************************************************************** + dirtydlg.cpp - description + ------------------- + begin : Fri Sep 13 2002 + copyright : (C) 2002, 2003 by Andras Mantia <amantia@kde.org> + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; version 2 of the License. * + * * + ***************************************************************************/ + +//qt includes +#include <qevent.h> +#include <qlabel.h> +#include <qradiobutton.h> +#include <qpushbutton.h> + +//kde includes +#include <kdialogbase.h> +#include <klocale.h> +#include <kprocess.h> +#include <kio/job.h> +#include <kio/jobclasses.h> +#include <kio/netaccess.h> +#include <kfileitem.h> + +//app includes +#include "dirtydialog.h" +#include "dirtydlg.h" +#include "resource.h" +#include "qextfileinfo.h" + +DirtyDlg::DirtyDlg(const QString& srcName, const QString& destName, bool createBackup, QWidget *parent, const char *name ) : KDialogBase(parent, name, true, i18n("File Changed"), KDialogBase::Ok) +{ + m_src.setPath(srcName); + m_dest.setPath(destName); + m_busy = false; + m_createBackup = createBackup; + m_mainWidget = new DirtyDialog(this); + m_mainWidget->textLabel->setText(i18n("<qt>The file <b>%1</b> was changed outside of the Quanta editor.</qt>").arg(srcName)); + setMainWidget(m_mainWidget); +} + +DirtyDlg::~DirtyDlg(){ +} +/** No descriptions */ +void DirtyDlg::slotOk() +{ + if (m_mainWidget->buttonCompare->isChecked()) + { + m_busy = true; + KProcess *proc = new KProcess(); + *proc << "kompare" << m_src.path() << m_dest.path(); + proc->start(); + connect(proc, SIGNAL(processExited(KProcess*)),SLOT(slotCompareDone(KProcess*))); + enableButton(KDialogBase::Ok, false); + enableButton(KDialogBase::Cancel, false); + } else + if (m_mainWidget->buttonLoad->isChecked()) + { + accept(); + } else + { + reject(); + } +} + +/** No descriptions */ +void DirtyDlg::slotCompareDone(KProcess* proc) +{ + delete proc; + + if (m_createBackup) + { + KURL backupURL = m_src; + backupURL.setPath(backupURL.path()+".backup"); + QExtFileInfo::copy(m_src, backupURL, -1, true, false, this); + } + + KIO::UDSEntry entry; + KIO::NetAccess::stat(m_src, entry, this); + KFileItem item(entry, m_src, false, true); + m_permissions = item.permissions(); + //TODO: Replace with KIO::NetAccess::file_move, when KDE 3.1 support + //is dropped + KIO::FileCopyJob *job = KIO::file_move(m_dest, m_src, m_permissions, true, false,false ); + connect( job, SIGNAL(result( KIO::Job *)), + SLOT (slotResult( KIO::Job *))); +} + + +/** No descriptions */ +void DirtyDlg::slotResult(KIO::Job *) +{ + m_busy = false; + accept(); +} + +/** No descriptions */ +void DirtyDlg::closeEvent(QCloseEvent* ev) +{ + if (m_busy) + ev->ignore(); + else + ev->accept(); +} + +#include "dirtydlg.moc" diff --git a/quanta/dialogs/dirtydlg.h b/quanta/dialogs/dirtydlg.h new file mode 100644 index 00000000..83d05339 --- /dev/null +++ b/quanta/dialogs/dirtydlg.h @@ -0,0 +1,55 @@ +/*************************************************************************** + dirtydlg.h - description + ------------------- + begin : Fri Sep 13 2002 + copyright : (C) 2002, 2003 by Andras Mantia + email : amantia@kde.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; version 2 of the License. * + * * + ***************************************************************************/ + +#ifndef DIRTYDLG_H +#define DIRTYDLG_H + +// kde includes +#include <kio/jobclasses.h> + +class DirtyDialog; +class KDialogBase; + +class KProcess; +class QCloseEvent; + +class DirtyDlg : public KDialogBase { + Q_OBJECT + +public: + DirtyDlg(const QString& srcName, const QString& destName, bool createBackup = false, QWidget *parent=0, const char *name=0); + ~DirtyDlg(); + +protected slots: // Protected slots + /** No descriptions */ + void slotOk(); + /** No descriptions */ + void slotCompareDone(KProcess*); + /** No descriptions */ + void slotResult(KIO::Job *); + /** No descriptions */ + virtual void closeEvent(QCloseEvent* ev); + +protected: // Protected attributes + KURL m_src; + KURL m_dest; + bool m_busy; + bool m_createBackup; + int m_permissions; + DirtyDialog* m_mainWidget; +}; + +#endif diff --git a/quanta/dialogs/donationdialog.ui b/quanta/dialogs/donationdialog.ui new file mode 100644 index 00000000..e5aab152 --- /dev/null +++ b/quanta/dialogs/donationdialog.ui @@ -0,0 +1,155 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>DonationDialog</class> +<comment>/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; version 2 of the License. * + * * + ***************************************************************************/ +</comment> +<author>(C) 2002, 2003 Andras Mantia <amantia@kde.org>, (C) 2002, 2003, 2004 Eric Laffoon <sequitur@kde.org></author> +<widget class="QDialog"> + <property name="name"> + <cstring>DonationDialog</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>497</width> + <height>407</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="caption"> + <string>Support Quanta with Financial Donation</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KPushButton" row="2" column="1"> + <property name="name"> + <cstring>closeButton</cstring> + </property> + <property name="text"> + <string>&Close</string> + </property> + </widget> + <widget class="KTextBrowser" row="0" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>KTextBrowser5</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>3</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShadow"> + <enum>Raised</enum> + </property> + <property name="textFormat"> + <enum>RichText</enum> + </property> + <property name="text"> + <string><div align="center"><h2>Your Contribution Can Make a Difference</h2></div>&nbsp;&nbsp;&nbsp;Quanta Plus would not be what it is today without sponsored developers. Andras Mantia has been full time since mid 2002 and Michal Rudolf came on part time in spring of 2004. Over the life of the project development has been largely sponsored by the efforts of the Project Manager, Eric Laffoon. In addition to his minimum 10-20 hour a week time commitment, his company, <a href="http://kittyhooch.com" target="_blank">Kitty Hooch</a> LLP has an ongoing financial commitment to keep Quanta in continuous development. Our sponsored developers are also a catalyst to our volunteer developers. +<br>&nbsp;&nbsp;&nbsp;&nbsp;Kitty Hooch is a small company with no employees, 2 active partners and several contract workers. After test marketing in the fall of 2001 they began wholesale and retail to national and international markets in early 2002. Kitty Hooch controls all aspects of their product production and marketing. Quanta sponsorship is no small expense for a small start up company. In 2003 cash flow and a bout with typhoid fever left Eric in debt and unable to keep up payments to Andras without help from the community. Thankfully a number of people stepped up. We now have several large sponsors along with a number of generous contributors. This has enabled us to bring Michal on part time. Now we are looking to be able to move him to full time. The challenge for this project to assume a leading role as a "killer desktop application" is great. +<div align="center"><h3>Balancing open source ideals and fiscal +reality</h3></div> +&nbsp;&nbsp;&nbsp;&nbsp;We believe that the open source model +is the future of software, but it is no guarantee of success. How many open source projects that we had high hopes for are unmaintained today? In early 2002 many people thought that Quanta Plus was dead. One person, Eric Laffoon, was not about to let the dream die. Quanta is more than surviving now, but developing a best-in-class tool is no easy task. We believe the key is consistent momentum. Nothing ensures this better than programmers who can work without financial or time distractions. Why do you think OSS projects die?<br>&nbsp;&nbsp;&nbsp;&nbsp;As Quanta grows the project management demands are increasing and ironically impacting the revenue stream it requires to continue. The impact of our sponsored developers has been huge! We are looking to make Quanta grow even faster. Eric needs to be able to free even more time to bring several new and exciting ideas through coding to release. We have other expenses too, with conferences and keeping our systems up to date so we don't lose time fighting old hardware. <i>We want to make Quanta the best web tool anywhere!</i>. This will require a nucleus of active core developers. We hope professional developers and companies using Quanta will help us to reach our goals with sponsorship donations that will relieve financial stresses. +<div align="center"><h3>Could Quanta die without your support?</h3></div>&nbsp;&nbsp;&nbsp;&nbsp;We'd like to think not! But from February 2001 to June 2002 there was very little activity and many months with no work done at all. This came about because of cash flow problems which led to the original developers leaving to do a commercial project. The fact remains that our most productive volunteer developers, as much as we think they're wonderful, go long periods where they just can't make time to code on the project. We estimate our active users number well over a million, yet we have only a few dozen people a year supporting the project. In fact 3-4 people account for over half of our current support. Clearly the actions of a few people make a huge difference, and yours can make a difference too. +<br><div align="center"><h3>Will you help make a difference?</h3></div> +&nbsp;&nbsp;&nbsp;&nbsp;If you wish to donate through PayPal +(online money transfer or credit card), visit our <a href="http://kdewebdev.org/donate.php">donation page</a>. +<br>&nbsp;&nbsp;&nbsp;&nbsp;If you are outside the PayPal area or wish to discuss corporate sponsorship contact the project manager:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Eric Laffoon, <a href="mailto:sequitur@kde.org?subject=Quanta%20sponsorship%20inquiry">sequitur@kde.org</a></string> + </property> + </widget> + <spacer row="2" column="0"> + <property name="name"> + <cstring>spacer1</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>365</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="KTextBrowser" row="1" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>KTextBrowser2</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>3</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>30</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>32767</width> + <height>40</height> + </size> + </property> + <property name="backgroundOrigin"> + <enum>WindowOrigin</enum> + </property> + <property name="focusPolicy"> + <enum>WheelFocus</enum> + </property> + <property name="frameShape"> + <enum>StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>Raised</enum> + </property> + <property name="text"> + <string><a href="http://kdewebdev.org/donate.php">Donate</a> through PayPal now.</string> + </property> + </widget> + </grid> +</widget> +<tabstops> + <tabstop>KTextBrowser5</tabstop> + <tabstop>KTextBrowser2</tabstop> + <tabstop>closeButton</tabstop> +</tabstops> +<slots> + <slot>init()</slot> +</slots> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>kpushbutton.h</includehint> + <includehint>ktextbrowser.h</includehint> + <includehint>ktextbrowser.h</includehint> +</includehints> +</UI> diff --git a/quanta/dialogs/dtdselectdialog.ui b/quanta/dialogs/dtdselectdialog.ui new file mode 100644 index 00000000..525a0429 --- /dev/null +++ b/quanta/dialogs/dtdselectdialog.ui @@ -0,0 +1,112 @@ +<!DOCTYPE UI><UI version="3.1" stdsetdef="1"> +<class>DTDSelectDialog</class> +<comment>/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; version 2 of the License. * + * * + ***************************************************************************/ +</comment> +<author>(C) 2002, 2003 Andras Mantia <amantia@kde.org></author> +<widget class="QWidget"> + <property name="name"> + <cstring>DTDSelectDialog</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>440</width> + <height>161</height> + </rect> + </property> + <property name="minimumSize"> + <size> + <width>440</width> + <height>160</height> + </size> + </property> + <property name="caption"> + <string>DTD Selector</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="0" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>messageLabel</cstring> + </property> + <property name="text"> + <string>Dialog message: +Dialog message2:</string> + </property> + <property name="scaledContents"> + <bool>true</bool> + </property> + <property name="alignment"> + <set>WordBreak|AlignVCenter</set> + </property> + </widget> + <widget class="QComboBox" row="1" column="1"> + <property name="name"> + <cstring>dtdCombo</cstring> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>textLabel</cstring> + </property> + <property name="text"> + <string>Current DTD:</string> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>comboLabel</cstring> + </property> + <property name="text"> + <string>Select DTD:</string> + </property> + </widget> + <widget class="QLineEdit" row="2" column="1"> + <property name="name"> + <cstring>currentDTD</cstring> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + <widget class="QCheckBox" row="3" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>convertDTD</cstring> + </property> + <property name="text"> + <string>Conver&t the document to the selected DTD</string> + </property> + </widget> + <widget class="QCheckBox" row="4" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>useClosestMatching</cstring> + </property> + <property name="text"> + <string>Do not show this dialog, use the closest matching DTD</string> + </property> + </widget> + </grid> +</widget> +<tabstops> + <tabstop>dtdCombo</tabstop> + <tabstop>currentDTD</tabstop> + <tabstop>convertDTD</tabstop> + <tabstop>useClosestMatching</tabstop> +</tabstops> +<includes> + <include location="local" impldecl="in implementation">dtdselectdialog.ui.h</include> +</includes> +<slots> + <slot>init()</slot> +</slots> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/quanta/dialogs/dtepeditdlg.cpp b/quanta/dialogs/dtepeditdlg.cpp new file mode 100644 index 00000000..c0bf4797 --- /dev/null +++ b/quanta/dialogs/dtepeditdlg.cpp @@ -0,0 +1,556 @@ +/*************************************************************************** + dtepeditdlg.cpp - description + ------------------- + begin : Tue Feb 1 11:07:24 2005 + copyright : (C) 2005 Andras Mantia <amantia@kde.org> + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; version 2 of the License. * + * * + ***************************************************************************/ + +#include <qcheckbox.h> +#include <qfile.h> +#include <qfileinfo.h> +#include <qgroupbox.h> +#include <qradiobutton.h> +#include <qtabwidget.h> +#include <qwidgetstack.h> + + +//kde includes +#include <kcombobox.h> +#include <kconfig.h> +#include <kfiledialog.h> +#include <kicondialog.h> +#include <klistbox.h> +#include <klineedit.h> +#include <klocale.h> +#include <kmessagebox.h> +#include <kstandarddirs.h> + +//own includes +#include "dtepeditdlg.h" +#include "dtepstructureeditdlgs.h" +#include "dtds.h" +#include "resource.h" +#include "quantacommon.h" + +DTEPEditDlg::DTEPEditDlg(const QString& descriptionFile, QWidget *parent, const char *name) + : DTEPEditDlgS(parent, name) +{ + nameEdit->setFocus(); + m_descriptionFile = descriptionFile; + + m_config = new KConfig(m_descriptionFile, false, false); + init(); + +} + + +DTEPEditDlg::~DTEPEditDlg() +{ + delete m_config; +} + +void DTEPEditDlg::slotFamilyChanged(int family) +{ + if (family == 0 && m_family != 0) + tabWidget->insertTab(m_pagesWidget, i18n("&Pages"), 1); + else + if (family == 1) + tabWidget->removePage(m_pagesWidget); + m_family = family; +} + +void DTEPEditDlg::init() +{ + m_pagesWidget = tabWidget->page(1); + readGeneral(); + if (m_family == 0) + readPages(); + else + tabWidget->removePage(m_pagesWidget); + readParserRules(); + readStructures(); +} + +void DTEPEditDlg::readGeneral() +{ + m_config->setGroup("General"); + nameEdit->setText(m_config->readEntry("Name")); + nickNameEdit->setText(m_config->readEntry("NickName")); + m_family = m_config->readNumEntry("Family", 1) - 1; + extensionEdit->setText(m_config->readEntry("DefaultExtension")); + mimeTypeEdit->setText(m_config->readEntry("MimeTypes")); + typeCombo->setCurrentItem(m_family); + rulesWidgetStack->raiseWidget(m_family); + generalWidgetStack->raiseWidget(m_family); + caseSensitive->setChecked(m_config->readBoolEntry("CaseSensitive", false)); + QString inherits = m_config->readEntry("Inherits"); + QStringList lst(DTDs::ref()->nameList()); + inheritsCombo->insertStringList(lst); + int idx = lst.findIndex(inherits); + if (idx == -1) + inheritsCombo->insertItem(inherits, 0); + else + inheritsCombo->setCurrentItem(idx); + + urlEdit->setText(m_config->readEntry("URL")); + doctypeEdit->setText(m_config->readEntry("DoctypeString")); + topLevel->setChecked(m_config->readBoolEntry("TopLevel", false)); + + m_config->setGroup("Toolbars"); + toolbarFolderEdit->setText(QuantaCommon::readPathEntry(m_config, "Location")); + toolbarsEdit->setText(m_config->readEntry("Names")); + +} + +void DTEPEditDlg::readPages() +{ + int i = 1; + while (m_config->hasGroup(QString("Page%1").arg(i)) && i < 6) + { + m_config->setGroup(QString("Page%1").arg(i)); + QString title = m_config->readEntry("Title"); + QString groups = m_config->readEntry("Groups"); + if (i == 1) + { + enablePage1->setChecked(true); + pageTitleEdit1->setText(title); + groupsEdit1->setText(groups); + } else + if (i == 2) + { + enablePage2->setChecked(true); + pageTitleEdit2->setText(title); + groupsEdit2->setText(groups); + } else + if (i == 3) + { + enablePage3->setChecked(true); + pageTitleEdit3->setText(title); + groupsEdit3->setText(groups); + } else + if (i == 4) + { + enablePage4->setChecked(true); + pageTitleEdit4->setText(title); + groupsEdit4->setText(groups); + } else + if (i == 5) + { + enablePage5->setChecked(true); + pageTitleEdit5->setText(title); + groupsEdit5->setText(groups); + } + i++; + } +} + +void DTEPEditDlg::readParserRules() +{ + m_config->setGroup("Extra rules"); + enableMinusInWords->setChecked(m_config->readBoolEntry("MinusAllowedInWord", false)); + attributeSeparatorEdit->setText(m_config->readEntry("AttributeSeparator")); + tagSeparatorEdit->setText(m_config->readEntry("TagSeparator")); + tagAfterEdit->setText(m_config->readEntry("TagAutoCompleteAfter")); + + if (m_family == 0) + { + extendedBooleans->setChecked(m_config->readEntry("BooleanAttributes", "extended") == "extended"); + trueEdit->setText(m_config->readEntry("BooleanTrue","true")); + falseEdit->setText(m_config->readEntry("BooleanFalse","false")); + xmlStyleTags->setChecked(m_config->readEntry("Single Tag Style", "xml").lower() == "xml"); + } else + { + attributesAfterEdit->setText(m_config->readEntry("AttributeAutoCompleteAfter")); + membersAfterEdit->setText(m_config->readEntry("MemberAutoCompleteAfter")); + } + + m_config->setGroup("Parsing rules"); + commentsEdit->setText(m_config->readEntry("Comments")); + mayContainEdit->setText(m_config->readEntry("MayContain")); + + if (m_family == 0) + { + specialAreasEdit->setText(m_config->readEntry("SpecialAreas")); + specialAreaNamesEdit->setText(m_config->readEntry("SpecialAreaNames")); + specialTagsEdit->setText(m_config->readEntry("SpecialTags")); + useCommonRules->setChecked(m_config->readBoolEntry("AppendCommonSpecialAreas", true)); + } else + { + areaBordersEdit->setText(m_config->readEntry("AreaBorders")); + definitionTagsEdit->setText(m_config->readEntry("Tags")); + structKeywordsEdit->setText(m_config->readEntry("StructKeywords")); + localStructKeywordsEdit->setText(m_config->readEntry("LocalScopeKeywords")); + structBeginEdit->setText(m_config->readEntry("StructBeginStr")); + structEndEdit->setText(m_config->readEntry("StructEndStr")); + structRxEdit->setText(m_config->readEntry("StructRx")); + } + +} + +void DTEPEditDlg::saveResult() +{ + QString targetFile = m_descriptionFile; + QFileInfo f(targetFile); + if (!f.isWritable()) + { + if (f.exists()) + { + if (KMessageBox::questionYesNo(this, i18n("<qt>The file <b>%1</b> is not writable.<br>Do you want to save the configuration to a different file?</qt>").arg(f.filePath()),i18n("Save As"),i18n("Save to Different File"), i18n("Do Not Save")) == KMessageBox::Yes) + { + targetFile = KFileDialog::getSaveFileName(locateLocal("data", resourceDir + "dtep/description.rc"), i18n("*.rc|DTEP Description"), this, i18n("Save Description As")); + } else + targetFile = ""; + } + } + if (!targetFile.isEmpty()) + { + QFile f(targetFile); + if (f.exists()) + f.remove(); + KConfig* newConfig = m_config->copyTo(targetFile); + newConfig->sync(); + writeGeneral(newConfig); + writePages(newConfig); + writeParserRules(newConfig); + writeStructures(newConfig); + newConfig->sync(); + delete newConfig; + } +} + +void DTEPEditDlg::writeGeneral(KConfig *config) +{ + config->setGroup("General"); + writeEntry(config, "Name", nameEdit->text()); + writeEntry(config, "NickName", nickNameEdit->text()); + config->writeEntry("Family", typeCombo->currentItem() + 1); + config->writeEntry("CaseSensitive", caseSensitive->isChecked()); + writeEntry(config, "Inherits", inheritsCombo->currentText()); + writeEntry(config, "URL", urlEdit->text()); + writeEntry(config, "DoctypeString", doctypeEdit->text()); + writeEntry(config, "DefaultExtension", extensionEdit->text()); + writeEntry(config, "MimeTypes", mimeTypeEdit->text()); + if (m_family == 1) + config->writeEntry("TopLevel", topLevel->isChecked()); + + config->setGroup("Toolbars"); + writeEntry(config, "Location", toolbarFolderEdit->text()); + writeEntry(config, "Names", toolbarsEdit->text()); +} + +void DTEPEditDlg::writePages(KConfig *config) +{ + config->deleteGroup("Pages"); + if (m_family == 0) + { + int num = 0; + if (enablePage1->isChecked()) + { + num++; + config->setGroup(QString("Page%1").arg(num)); + writeEntry(config, "Title", pageTitleEdit1->text()); + writeEntry(config, "Groups", groupsEdit1->text()); + } + if (enablePage2->isChecked()) + { + num++; + config->setGroup(QString("Page%1").arg(num)); + writeEntry(config, "Title", pageTitleEdit2->text()); + writeEntry(config, "Groups", groupsEdit2->text()); + } + if (enablePage3->isChecked()) + { + num++; + config->setGroup(QString("Page%1").arg(num)); + writeEntry(config, "Title", pageTitleEdit3->text()); + writeEntry(config, "Groups", groupsEdit3->text()); + } + if (enablePage4->isChecked()) + { + num++; + config->setGroup(QString("Page%1").arg(num)); + writeEntry(config, "Title", pageTitleEdit4->text()); + writeEntry(config, "Groups", groupsEdit4->text()); + } + if (enablePage5->isChecked()) + { + num++; + config->setGroup(QString("Page%1").arg(num)); + writeEntry(config, "Title", pageTitleEdit5->text()); + writeEntry(config, "Groups", groupsEdit5->text()); + } + config->setGroup("General"); + config->writeEntry("NumOfPages", num); + } +} + +void DTEPEditDlg::writeParserRules(KConfig *config) +{ + config->setGroup("Extra rules"); + config->writeEntry("MinusAllowedInWord", enableMinusInWords->isChecked()); + writeEntry(config, "AttributeSeparator", attributeSeparatorEdit->text()); + writeEntry(config, "TagSeparator", tagSeparatorEdit->text()); + writeEntry(config, "TagAutoCompleteAfter", tagAfterEdit->text()); + + if (m_family == 0) + { + writeEntry(config, "BooleanAttributes", extendedBooleans->isChecked() ? "extended" : "simple"); + writeEntry(config, "BooleanTrue", trueEdit->text()); + writeEntry(config, "BooleanFalse", falseEdit->text()); + writeEntry(config, "Single Tag Style", xmlStyleTags->isChecked() ? "xml" : "html"); + } else + { + writeEntry(config, "AttributeAutoCompleteAfter", attributesAfterEdit->text()); + writeEntry(config, "MemberAutoCompleteAfter", membersAfterEdit->text()); + } + + config->setGroup("Parsing rules"); + writeEntry(config, "Comments", commentsEdit->text()); + writeEntry(config, "MayContain", mayContainEdit->text()); + + if (m_family == 0) + { + writeEntry(config, "SpecialAreas", specialAreasEdit->text()); + writeEntry(config, "SpecialAreaNames", specialAreaNamesEdit->text()); + writeEntry(config, "SpecialTags", specialTagsEdit->text()); + config->writeEntry("AppendCommonSpecialAreas", useCommonRules->isChecked()); + } else + { + writeEntry(config, "AreaBorders", areaBordersEdit->text()); + writeEntry(config, "Tags", definitionTagsEdit->text()); + writeEntry(config, "StructKeywords", structKeywordsEdit->text()); + writeEntry(config, "LocalScopeKeywords", localStructKeywordsEdit->text()); + writeEntry(config, "StructBeginStr", structBeginEdit->text()); + writeEntry(config, "StructEndStr", structEndEdit->text()); + writeEntry(config, "StructRx", structRxEdit->text()); + } +} + +void DTEPEditDlg::readStructures() +{ + m_config->setGroup("Extra rules"); + int variableGroupId = m_config->readNumEntry("VariableGroupIndex", -1); + int functionGroupId = m_config->readNumEntry("FunctionGroupIndex", -1); + int classGroupId = m_config->readNumEntry("ClassGroupIndex", -1); + int objectGroupId = m_config->readNumEntry("ObjectGroupIndex", -1); + + int i = 1; + while (m_config->hasGroup(QString("StructGroup_%1").arg(i))) + { + StructGroup group; + m_config->setGroup(QString("StructGroup_%1").arg(i)); + group.name = m_config->readEntry("Name"); + group.noName = m_config->readEntry("No_Name"); + group.icon = m_config->readEntry("Icon"); + group.tag = m_config->readEntry("Tag"); + group.hasFileName = m_config->readBoolEntry("HasFileName", false); + group.fileNameRx = m_config->readEntry("FileNameRx"); + group.appendToTags = m_config->readBoolEntry("AppendToTags", false); + group.parentGroup = m_config->readEntry("ParentGroup"); + group.definitionRx = m_config->readEntry("DefinitionRx"); + group.definitionRxMinimal = m_config->readBoolEntry("DefinitionRx_Minimal", false); + group.usageRx = m_config->readEntry("UsageRx"); + group.typeRx = m_config->readEntry("TypeRx"); + group.tagType = m_config->readEntry("TagType"); + group.parseFile = m_config->readBoolEntry("ParseFile", false); + group.completeAfterRx = m_config->readEntry("AutoCompleteAfter"); + group.removeRx = m_config->readEntry("RemoveFromAutoCompleteWord"); + group.variableGroup = (variableGroupId == i); + group.functionGroup = (functionGroupId == i); + group.classGroup = (classGroupId == i); + group.objectGroup = (objectGroupId == i); + group.simpleGroup = (!group.variableGroup && !group.functionGroup && !group.classGroup && !group.objectGroup); + + m_structGroups.append(group); + i++; + } + for (QValueList<StructGroup>::ConstIterator it = m_structGroups.constBegin(); it != m_structGroups.constEnd(); ++it) + { + structuresList->insertItem((*it).name); + } +} + +void DTEPEditDlg::writeStructures(KConfig *config) +{ + config->setGroup("Extra rules"); + config->writeEntry("StructGroupsCount", m_structGroups.count()); + + int i = 1; + for (QValueList<StructGroup>::ConstIterator it = m_structGroups.constBegin(); it != m_structGroups.constEnd(); ++it) + { + StructGroup group = *it; + config->setGroup(QString("StructGroup_%1").arg(i)); + writeEntry(config, "Name", group.name); + writeEntry(config, "No_Name", group.noName); + writeEntry(config, "Icon", group.icon); + writeEntry(config, "Tag", group.tag); + config->writeEntry("HasFileName", group.hasFileName); + writeEntry(config, "FileNameRx", group.fileNameRx); + config->writeEntry("AppendToTags", group.appendToTags); + if (m_family == 1) + { + writeEntry(config, "ParentGroup", group.parentGroup); + writeEntry(config, "DefinitionRx", group.definitionRx); + config->writeEntry("DefinitionRx_Minimal", group.definitionRxMinimal); + writeEntry(config, "UsageRx", group.usageRx); + writeEntry(config, "TypeRx", group.typeRx); + writeEntry(config, "TagType", group.tagType); + config->writeEntry("ParseFile", group.parseFile); + writeEntry(config, "AutoCompleteAfter", group.completeAfterRx); + writeEntry(config, "RemoveFromAutoCompleteWord", group.removeRx); + if (group.variableGroup) + { + config->setGroup("Extra rules"); + config->writeEntry("VariableGroupIndex", i); + } else + if (group.functionGroup) + { + config->setGroup("Extra rules"); + config->writeEntry("FunctionGroupIndex", i); + } else + if (group.classGroup) + { + config->setGroup("Extra rules"); + config->writeEntry("ClassGroupIndex", i); + } else + if (group.objectGroup) + { + config->setGroup("Extra rules"); + config->writeEntry("ObjectGroupIndex", i); + } + } + + i++; + } + for (QValueList<StructGroup>::ConstIterator it = m_structGroups.constBegin(); it != m_structGroups.constEnd(); ++it) + { + structuresList->insertItem((*it).name); + } +} + +void DTEPEditDlg::slotEditStructGroup() +{ + int currentItem = structuresList->currentItem(); + if (currentItem != -1) + { + KDialogBase editDlg(this, "edit_group", true, i18n("Edit Structure Group"), KDialogBase::Ok | KDialogBase::Cancel); + DTEPStructureEditDlgS structDlg(&editDlg); + editDlg.setMainWidget(&structDlg); + + StructGroup group = m_structGroups[currentItem]; + structDlg.nameEdit->setText(group.name); + structDlg.noNameEdit->setText(group.noName); + structDlg.iconButton->setIcon(group.icon); + structDlg.tagEdit->setText(group.tag); + structDlg.hasFilename->setChecked(group.hasFileName); + structDlg.fileNameRxEdit->setText(group.fileNameRx); + structDlg.appendToTags->setChecked(group.appendToTags); + structDlg.parentGroupEdit->setText(group.parentGroup); + for (int i = 0; i < structDlg.tagTypeCombo->count(); i++) + { + if (structDlg.tagTypeCombo->text(i) == group.tagType) + { + structDlg.tagTypeCombo->setCurrentItem(i); + break; + } + } + + structDlg.definitionRxEdit->setText(group.definitionRx); + structDlg.definitionRxMinimal->setChecked(group.definitionRxMinimal); + structDlg.usageRxEdit->setText(group.usageRx); + structDlg.typeRxEdit->setText(group.typeRx); + structDlg.autoCompleteRxEdit->setText(group.completeAfterRx); + structDlg.removeRxEdit->setText(group.removeRx); + structDlg.parseFile->setChecked(group.parseFile); + structDlg.simpleGroup->setChecked(group.simpleGroup); + structDlg.variableGroup->setChecked(group.variableGroup); + structDlg.functionGroup->setChecked(group.functionGroup); + structDlg.classGroup->setChecked(group.classGroup); + structDlg.objectGroup->setChecked(group.objectGroup); + + if (m_family == 0) + structDlg.pseudoGroupBox->setEnabled(false); + + if (editDlg.exec()) + { + StructGroup group = readFromStructDlg(&structDlg); + m_structGroups[currentItem] = group; + structuresList->removeItem(currentItem); + structuresList->insertItem(group.name, currentItem); + } + } +} + +void DTEPEditDlg::slotAddStructGroup() +{ + KDialogBase editDlg(this, "edit_group", true, i18n("Add Structure Group"), KDialogBase::Ok | KDialogBase::Cancel); + DTEPStructureEditDlgS structDlg(&editDlg); + editDlg.setMainWidget(&structDlg); + if (editDlg.exec()) + { + StructGroup group = readFromStructDlg(&structDlg); + m_structGroups.append(group); + structuresList->insertItem(group.name); + } +} + +StructGroup DTEPEditDlg::readFromStructDlg(DTEPStructureEditDlgS *structDlg) +{ + StructGroup group; + + group.name = structDlg->nameEdit->text(); + group.noName = structDlg->noNameEdit->text(); + group.icon = structDlg->iconButton->icon(); + group.tag = structDlg->tagEdit->text(); + group.hasFileName = structDlg->hasFilename->isChecked(); + group.fileNameRx = structDlg->fileNameRxEdit->text(); + group.appendToTags = structDlg->appendToTags->isChecked(); + group.parentGroup = structDlg->parentGroupEdit->text(); + group.tagType = structDlg->tagTypeCombo->currentText(); + group.definitionRx = structDlg->definitionRxEdit->text(); + group.definitionRxMinimal = structDlg->definitionRxMinimal->isChecked(); + group.usageRx = structDlg->usageRxEdit->text(); + group.typeRx = structDlg->typeRxEdit->text(); + group.completeAfterRx = structDlg->autoCompleteRxEdit->text(); + group.removeRx = structDlg->removeRxEdit->text(); + group.parseFile = structDlg->parseFile->isChecked(); + group.simpleGroup = structDlg->simpleGroup->isChecked(); + group.variableGroup = structDlg->variableGroup->isChecked(); + group.functionGroup = structDlg->functionGroup->isChecked(); + group.classGroup = structDlg->classGroup->isChecked(); + group.objectGroup = structDlg->objectGroup->isChecked(); + + return group; +} + +void DTEPEditDlg::slotDeleteStructGroup() +{ + int currentItem = structuresList->currentItem(); + if (currentItem != -1) + { + if (KMessageBox::warningContinueCancel(this, i18n("<qt>Do you really want to delete the <b>%1</b> group?</qt>").arg(structuresList->currentText()), i18n("Delete Group"),KStdGuiItem::del()) == KMessageBox::Continue) + { + m_structGroups.remove(m_structGroups.at(currentItem)); + structuresList->removeItem(currentItem); + } + } +} + +void DTEPEditDlg::writeEntry(KConfig *config, const QString &key, const QString &value) +{ + if (value.isEmpty()) + config->deleteEntry(key); + else + config->writeEntry(key, value); +} + + +#include "dtepeditdlg.moc" diff --git a/quanta/dialogs/dtepeditdlg.h b/quanta/dialogs/dtepeditdlg.h new file mode 100644 index 00000000..45bd3d6d --- /dev/null +++ b/quanta/dialogs/dtepeditdlg.h @@ -0,0 +1,89 @@ +/*************************************************************************** + dtepeditdlg.h - description + ------------------- + begin : Tue Feb 1 11:07:24 2005 + copyright : (C) 2005 Andras Mantia <amantia@kde.org> + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; version 2 of the License. * + * * + ***************************************************************************/ + +#ifndef DTEPEDITDLG_H +#define DTEPEDITDLG_H + +//qt includes +#include <qvaluelist.h> + +//own includes +#include "dtepeditdlgs.h" + +/** +@author Andras Mantia +*/ + +class KConfig; +class DTEPStructureEditDlgS; + +struct StructGroup { + QString name; ///<the name of the group + QString noName; ///<the text when there are no elements in the group + QString icon; ///<the icon of the group + QString tag; + bool hasFileName; + QString fileNameRx; + bool appendToTags; + QString parentGroup; + QString definitionRx; + bool definitionRxMinimal; + QString usageRx; + QString typeRx; + QString tagType; + bool parseFile; + QString completeAfterRx; + QString removeRx; + bool simpleGroup; + bool variableGroup; + bool functionGroup; + bool classGroup; + bool objectGroup; +}; + +class DTEPEditDlg : public DTEPEditDlgS +{ + Q_OBJECT + public: + DTEPEditDlg(const QString& descriptionFile, QWidget *parent = 0, const char *name = 0); + ~DTEPEditDlg(); + void saveResult(); + void slotFamilyChanged(int family); + void slotEditStructGroup(); + void slotAddStructGroup(); + void slotDeleteStructGroup(); + + private: + void init(); + void readGeneral(); + void readPages(); + void readParserRules(); + void readStructures(); + StructGroup readFromStructDlg(DTEPStructureEditDlgS *structDlg); + + void writeGeneral(KConfig *config); + void writePages(KConfig *config); + void writeParserRules(KConfig *config); + void writeStructures(KConfig *config); + void writeEntry(KConfig *config, const QString &key, const QString &value); + + QString m_descriptionFile; + KConfig *m_config; + int m_family; + QWidget *m_pagesWidget; + QValueList<StructGroup> m_structGroups; +}; + +#endif diff --git a/quanta/dialogs/dtepeditdlgs.ui b/quanta/dialogs/dtepeditdlgs.ui new file mode 100644 index 00000000..739ffcc5 --- /dev/null +++ b/quanta/dialogs/dtepeditdlgs.ui @@ -0,0 +1,1967 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>DTEPEditDlgS</class> +<comment>/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; version 2 of the License. * + * * + ***************************************************************************/ +</comment> +<author>(C) 2005 Andras Mantia <amantia@kde.org></author> +<widget class="QWidget"> + <property name="name"> + <cstring>DTEPEditDlgS</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>655</width> + <height>598</height> + </rect> + </property> + <property name="caption"> + <string>Configure DTEP</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QTabWidget" row="0" column="0"> + <property name="name"> + <cstring>tabWidget</cstring> + </property> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>&General</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Name:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>kLineEdit1</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>DTD definition string</string> + </property> + <property name="whatsThis" stdset="0"> + <string>The real name of the DTEP. In case of XML DTEPs this should be the DTD definition string, like -<i>//W3C//DTD&nbsp;HTML&nbsp;4.01&nbsp;Transitional//EN</i>.</string> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>textLabel2</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Short name:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>kLineEdit2</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Beautified, user visible name</string> + </property> + <property name="whatsThis" stdset="0"> + <string>The user visible, beautified name. If not defined, the real name is used.</string> + </property> + </widget> + <spacer row="3" column="3" rowspan="1" colspan="3"> + <property name="name"> + <cstring>spacer2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="KLineEdit" row="0" column="1" rowspan="1" colspan="5"> + <property name="name"> + <cstring>nameEdit</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="toolTip" stdset="0"> + <string>DTD definition string</string> + </property> + <property name="whatsThis" stdset="0"> + <string>The real name of the DTEP. In case of XML DTEPs this should be the DTD definition string, like -<i>//W3C//DTD&nbsp;HTML&nbsp;4.01&nbsp;Transitional//EN</i>.</string> + </property> + </widget> + <widget class="KLineEdit" row="1" column="1" rowspan="1" colspan="5"> + <property name="name"> + <cstring>nickNameEdit</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="toolTip" stdset="0"> + <string>Beautified, user visible name</string> + </property> + <property name="whatsThis" stdset="0"> + <string>The user visible, beautified name. If not defined, the real name is used.</string> + </property> + </widget> + <spacer row="9" column="2"> + <property name="name"> + <cstring>spacer3</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>50</height> + </size> + </property> + </spacer> + <widget class="QGroupBox" row="8" column="0" rowspan="1" colspan="6"> + <property name="name"> + <cstring>groupBox1</cstring> + </property> + <property name="title"> + <string>Type Specific Settings</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QWidgetStack" row="0" column="0"> + <property name="name"> + <cstring>generalWidgetStack</cstring> + </property> + <widget class="QWidget"> + <property name="name"> + <cstring>WStackPage</cstring> + </property> + <attribute name="id"> + <number>0</number> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel3</cstring> + </property> + <property name="text"> + <string>URL:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>urlEdit</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>URL pointing to the DTD definiton file</string> + </property> + <property name="whatsThis" stdset="0"> + <string>URL pointing to the DTD definiton file, like <i>http://www.w3.org/TR/html4/loose.dtd</i>.</string> + </property> + </widget> + <widget class="QLabel" row="1" column="0" rowspan="2" colspan="1"> + <property name="name"> + <cstring>textLabel4</cstring> + </property> + <property name="text"> + <string>DOCT&YPE string:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>doctypeEdit</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>The string that should appear in the !DOCTYPE tag</string> + </property> + <property name="whatsThis" stdset="0"> + <string>The string that should appear in the !DOCTYPE tag, like<br> +<i>HTML&nbsp;PUBLIC&nbsp;"-//W3C//DTD&nbsp;HTML&nbsp;4.01&nbsp;Transitional//EN"&nbsp;&nbsp;&nbsp;<br>"http://www.w3.org/TR/html4/loose.dtd"</i></string> + </property> + </widget> + <widget class="KLineEdit" row="0" column="1" rowspan="2" colspan="1"> + <property name="name"> + <cstring>urlEdit</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>URL pointing to the DTD definiton file</string> + </property> + <property name="whatsThis" stdset="0"> + <string>URL pointing to the DTD definiton file, like <i>http://www.w3.org/TR/html4/loose.dtd</i>.</string> + </property> + </widget> + <widget class="KLineEdit" row="2" column="1"> + <property name="name"> + <cstring>doctypeEdit</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>The string that should appear in the !DOCTYPE tag</string> + </property> + <property name="whatsThis" stdset="0"> + <string>The string that should appear in the !DOCTYPE tag, like<br> +<i>HTML&nbsp;PUBLIC&nbsp;"-//W3C//DTD&nbsp;HTML&nbsp;4.01&nbsp;Transitional//EN"&nbsp;&nbsp;&nbsp;<br>"http://www.w3.org/TR/html4/loose.dtd"</i></string> + </property> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>WStackPage</cstring> + </property> + <attribute name="id"> + <number>1</number> + </attribute> + <widget class="QCheckBox"> + <property name="name"> + <cstring>topLevel</cstring> + </property> + <property name="geometry"> + <rect> + <x>10</x> + <y>10</y> + <width>107</width> + <height>27</height> + </rect> + </property> + <property name="text"> + <string>Top level</string> + </property> + <property name="toolTip" stdset="0"> + <string>Check if the DTEP can act as a top level DTEP.</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Check if the DTEP can act as a top level DTEP. This means that the document can be of this type. Some pseudo DTEPs cannot act as a top level DTEP, like <i>PHP</i> as they are always included as part of another DTEP, while some others can be included and act as standalone as well, like the case of <i>CSS</i>.</string> + </property> + </widget> + </widget> + </widget> + </grid> + </widget> + <widget class="QLabel" row="5" column="0"> + <property name="name"> + <cstring>textLabel9</cstring> + </property> + <property name="text"> + <string>Toolbar folder:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>toolbarFolderEdit</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>The name of the folder where the toolbars are stored</string> + </property> + <property name="whatsThis" stdset="0"> + <string>The name of the folder where the toolbars are stored. This is a relative name to <br><i>$KDEDIR(&nbsp;or&nbsp;$KDEHOME)/share/apps/quanta/toolbars</i> .</string> + </property> + </widget> + <widget class="KLineEdit" row="5" column="1" rowspan="1" colspan="5"> + <property name="name"> + <cstring>toolbarFolderEdit</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>The name of the folder where the toolbars are stored</string> + </property> + <property name="whatsThis" stdset="0"> + <string>The name of the folder where the toolbars are stored. This is a relative name to <br><i>$KDEDIR(&nbsp;or&nbsp;$KDEHOME)/share/apps/quanta/toolbars</i> .</string> + </property> + </widget> + <widget class="QLabel" row="6" column="0"> + <property name="name"> + <cstring>textLabel10</cstring> + </property> + <property name="text"> + <string>&Autoloaded toolbars:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>toolbarsEdit</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Comma separated list of toolbars</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Comma separated list of toolbars from the toolbar folder that will be loaded when a document with this DTEP is loaded.</string> + </property> + </widget> + <widget class="KLineEdit" row="6" column="1" rowspan="1" colspan="5"> + <property name="name"> + <cstring>toolbarsEdit</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Comma separated list of toolbars</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Comma separated list of toolbars from the toolbar folder that will be loaded when a document with this DTEP is loaded.</string> + </property> + </widget> + <widget class="QCheckBox" row="7" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>caseSensitive</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Case sensitive</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="toolTip" stdset="0"> + <string>Check if the DTEP has case sensitive tags</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Indicates whether the DTEP has case sensitive tags. In case of XML this should be checked, but for example HTML variants are not case sensitive.</string> + </property> + </widget> + <widget class="QLabel" row="3" column="0"> + <property name="name"> + <cstring>textLabel7</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Type:</string> + </property> + <property name="toolTip" stdset="0"> + <string>The family to where this DTEP belongs.</string> + </property> + <property name="whatsThis" stdset="0"> + <string>The family to where this DTEP belong. There are two families:<br><p><b>XML style</b>:DTEP describing an XML like language</p> +<p><b>Pseudo type</b>:DTEP describing some other language, where the notion of a tag is not the same as in XML. Examples are <i>PHP, JavaScript, CSS</i>.</p></string> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>textLabel8</cstring> + </property> + <property name="text"> + <string>Inherits:</string> + </property> + <property name="toolTip" stdset="0"> + <string>The DTEP name from where this DTEP inherits the tags.</string> + </property> + <property name="whatsThis" stdset="0"> + <string>The real name of the DTEP (like -<i>//W3C//DTD&nbsp;HTML&nbsp;4.01&nbsp;Transitional//EN</i>) from where the current DTEP inherits the tags.</string> + </property> + </widget> + <widget class="KComboBox" row="3" column="1" rowspan="1" colspan="2"> + <item> + <property name="text"> + <string>XML Style</string> + </property> + </item> + <item> + <property name="text"> + <string>Pseudo Type</string> + </property> + </item> + <property name="name"> + <cstring>typeCombo</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="toolTip" stdset="0"> + <string>The family to where this DTEP belongs.</string> + </property> + <property name="whatsThis" stdset="0"> + <string>The family to where this DTEP belong. There are two families:<br><p><b>XML style</b>:DTEP describing an XML like language</p> +<p><b>Pseudo type</b>:DTEP describing some other language, where the notion of a tag is not the same as in XML. Examples are <i>PHP, JavaScript, CSS</i>.</p></string> + </property> + </widget> + <widget class="QLabel" row="4" column="0"> + <property name="name"> + <cstring>textLabel1_2</cstring> + </property> + <property name="text"> + <string>Mimet&ypes:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>mimeTypeEdit</cstring> + </property> + </widget> + <widget class="KComboBox" row="2" column="1" rowspan="1" colspan="5"> + <property name="name"> + <cstring>inheritsCombo</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="editable"> + <bool>true</bool> + </property> + <property name="toolTip" stdset="0"> + <string>The DTEP name from where this DTEP inherits the tags.</string> + </property> + <property name="whatsThis" stdset="0"> + <string>The real name of the DTEP (like -<i>//W3C//DTD&nbsp;HTML&nbsp;4.01&nbsp;Transitional//EN</i>) from where the current DTEP inherits the tags.</string> + </property> + </widget> + <widget class="KLineEdit" row="4" column="1" rowspan="1" colspan="2"> + <property name="name"> + <cstring>mimeTypeEdit</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Comma separated list of mimetypes</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Comma separated list of mimetypes. Files of these types are treated as belonging to this DTEP, unless the !DOCTYPE entry says something else.</string> + </property> + </widget> + <widget class="KLineEdit" row="4" column="5"> + <property name="name"> + <cstring>extensionEdit</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>The default extension of files belonging to this DTEP</string> + </property> + </widget> + <widget class="QLabel" row="4" column="4"> + <property name="name"> + <cstring>textLabel2_2</cstring> + </property> + <property name="text"> + <string>E&xtension:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>extensionEdit</cstring> + </property> + </widget> + <spacer row="4" column="3"> + <property name="name"> + <cstring>spacer6</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>P&ages</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer row="15" column="2"> + <property name="name"> + <cstring>spacer4</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>50</height> + </size> + </property> + </spacer> + <widget class="QCheckBox" row="0" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>enablePage1</cstring> + </property> + <property name="text"> + <string>Enable the first extra page</string> + </property> + <property name="toolTip" stdset="0"> + <string>Every tab edit dialog will have one more extra page aside of the main page</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Every tab edit dialog will have one more extra page aside of the main page. You can configure what will be on this page in the below fields.</string> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>textLabel11</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Title:</string> + </property> + <property name="toolTip" stdset="0"> + <string>The title of the page</string> + </property> + <property name="whatsThis" stdset="0"> + <string>The title of the page, like <b>Core && i18n</b>. As you see, the ampersand must be doubled.</string> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>textLabel12</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Groups:</string> + </property> + <property name="toolTip" stdset="0"> + <string>Comma separated list of the common attribute groups</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Comma separated list of the common attribute groups. The attributes from the listed groups will appear on this page.<br>The common attributes are specified in each DTEP's <i>common.tag</i> file, where the <i>common="yes"</i> attribute must be set.<br>The following example defined the common I18n attribute group:<br><p><b> +&lt;tag name="I18n" common="yes"><br> +&nbsp;&nbsp;&lt;attr name="lang" type="input" /><br> +&nbsp;&nbsp;&lt;attr name="dir" type="input" /><br> +&lt;/tag> +</b></p></string> + </property> + </widget> + <widget class="QCheckBox" row="3" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>enablePage2</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Enable the second extra page</string> + </property> + <property name="toolTip" stdset="0"> + <string>See the tooltip and "What's This?" information for the first checkbox</string> + </property> + </widget> + <widget class="QCheckBox" row="6" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>enablePage3</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Enable the third extra page</string> + </property> + <property name="toolTip" stdset="0"> + <string>See the tooltip and "What's This?" information for the first checkbox</string> + </property> + </widget> + <widget class="QCheckBox" row="9" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>enablePage4</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Enable the fourth extra page</string> + </property> + <property name="toolTip" stdset="0"> + <string>See the tooltip and "What's This?" information for the first checkbox</string> + </property> + </widget> + <widget class="QCheckBox" row="12" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>enablePage5</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Enable the fifth extra page</string> + </property> + <property name="toolTip" stdset="0"> + <string>See the tooltip and "What's This?" information for the first checkbox</string> + </property> + </widget> + <widget class="KLineEdit" row="1" column="2"> + <property name="name"> + <cstring>pageTitleEdit1</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip" stdset="0"> + <string>The title of the page</string> + </property> + <property name="whatsThis" stdset="0"> + <string>The title of the page, like <b>Core && i18n</b>. As you see, the ampersand must be doubled.</string> + </property> + </widget> + <widget class="KLineEdit" row="2" column="2"> + <property name="name"> + <cstring>groupsEdit1</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip" stdset="0"> + <string>Comma separated list of the common attribute groups</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Comma separated list of the common attribute groups. The attributes from the listed groups will appear on this page.<br>The common attributes are specified in each DTEP's <i>common.tag</i> file, where the <i>common="yes"</i> attribute must be set.<br>The following example defined the common I18n attribute group:<br><p><b> +&lt;tag name="I18n" common="yes"><br> +&nbsp;&nbsp;&lt;attr name="lang" type="input" /><br> +&nbsp;&nbsp;&lt;attr name="dir" type="input" /><br> +&lt;/tag> +</b></p></string> + </property> + </widget> + <widget class="KLineEdit" row="10" column="2"> + <property name="name"> + <cstring>pageTitleEdit4</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip" stdset="0"> + <string>See the tooltip and "What's This?" information for the first page fields</string> + </property> + </widget> + <widget class="QLabel" row="8" column="0"> + <property name="name"> + <cstring>textLabel12_3</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Groups:</string> + </property> + <property name="toolTip" stdset="0"> + <string>See the tooltip and "What's This?" information for the first page fields</string> + </property> + </widget> + <widget class="KLineEdit" row="4" column="2"> + <property name="name"> + <cstring>pageTitleEdit2</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip" stdset="0"> + <string>See the tooltip and "What's This?" information for the first page fields</string> + </property> + </widget> + <widget class="QLabel" row="10" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>textLabel11_3_2</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Title:</string> + </property> + <property name="toolTip" stdset="0"> + <string>See the tooltip and "What's This?" information for the first page fields</string> + </property> + </widget> + <widget class="QLabel" row="4" column="0"> + <property name="name"> + <cstring>textLabel11_2</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Title:</string> + </property> + <property name="toolTip" stdset="0"> + <string>See the tooltip and "What's This?" information for the first page fields</string> + </property> + </widget> + <widget class="QLabel" row="5" column="0"> + <property name="name"> + <cstring>textLabel12_2</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Groups:</string> + </property> + <property name="toolTip" stdset="0"> + <string>See the tooltip and "What's This?" information for the first page fields</string> + </property> + </widget> + <widget class="QLabel" row="7" column="0"> + <property name="name"> + <cstring>textLabel11_3</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Title:</string> + </property> + <property name="toolTip" stdset="0"> + <string>See the tooltip and "What's This?" information for the first page fields</string> + </property> + </widget> + <widget class="QLabel" row="11" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>textLabel12_3_2</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Groups:</string> + </property> + <property name="toolTip" stdset="0"> + <string>See the tooltip and "What's This?" information for the first page fields</string> + </property> + </widget> + <widget class="KLineEdit" row="5" column="2"> + <property name="name"> + <cstring>groupsEdit2</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip" stdset="0"> + <string>See the tooltip and "What's This?" information for the first page fields</string> + </property> + </widget> + <widget class="QLabel" row="13" column="0"> + <property name="name"> + <cstring>textLabel11_5</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Title:</string> + </property> + <property name="toolTip" stdset="0"> + <string>See the tooltip and "What's This?" information for the first page fields</string> + </property> + </widget> + <widget class="KLineEdit" row="11" column="2"> + <property name="name"> + <cstring>groupsEdit4</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip" stdset="0"> + <string>See the tooltip and "What's This?" information for the first page fields</string> + </property> + </widget> + <widget class="QLabel" row="14" column="0"> + <property name="name"> + <cstring>textLabel12_5</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Groups:</string> + </property> + <property name="toolTip" stdset="0"> + <string>See the tooltip and "What's This?" information for the first page fields</string> + </property> + </widget> + <widget class="KLineEdit" row="7" column="1" rowspan="1" colspan="2"> + <property name="name"> + <cstring>pageTitleEdit3</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip" stdset="0"> + <string>See the tooltip and "What's This?" information for the first page fields</string> + </property> + </widget> + <widget class="KLineEdit" row="8" column="1" rowspan="1" colspan="2"> + <property name="name"> + <cstring>groupsEdit3</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip" stdset="0"> + <string>See the tooltip and "What's This?" information for the first page fields</string> + </property> + </widget> + <widget class="KLineEdit" row="14" column="2"> + <property name="name"> + <cstring>groupsEdit5</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip" stdset="0"> + <string>See the tooltip and "What's This?" information for the first page fields</string> + </property> + </widget> + <widget class="KLineEdit" row="13" column="2"> + <property name="name"> + <cstring>pageTitleEdit5</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip" stdset="0"> + <string>See the tooltip and "What's This?" information for the first page fields</string> + </property> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>TabPage</cstring> + </property> + <attribute name="title"> + <string>Parsing &Rules</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox" row="1" column="0" rowspan="1" colspan="5"> + <property name="name"> + <cstring>enableMinusInWords</cstring> + </property> + <property name="text"> + <string>Enable minus in words</string> + </property> + <property name="toolTip" stdset="0"> + <string>Treat the minus sign as part of a word</string> + </property> + <property name="whatsThis" stdset="0"> + <string>If enabled <b>this-is-a-word</b> is treated like a word. Otherwise it is treated like 4 words.</string> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>textLabel13</cstring> + </property> + <property name="text"> + <string>Comments:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>kLineEdit10</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Comma separated list of area borders for comments</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Comma separated list of area borders for comments. <i>EOL</i> means end of line, used for single line comments.<br> +Example: <b>//&nbsp;EOL,&nbsp;/*&nbsp;*/</b></string> + </property> + </widget> + <widget class="QGroupBox" row="0" column="0" rowspan="1" colspan="5"> + <property name="name"> + <cstring>groupBox7</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Type Specific Rules</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QWidgetStack" row="0" column="0"> + <property name="name"> + <cstring>rulesWidgetStack</cstring> + </property> + <widget class="QWidget"> + <property name="name"> + <cstring>WStackPage</cstring> + </property> + <attribute name="id"> + <number>0</number> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox" row="4" column="0" rowspan="1" colspan="7"> + <property name="name"> + <cstring>xmlStyleTags</cstring> + </property> + <property name="text"> + <string>XML style single tags</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="toolTip" stdset="0"> + <string>Check to use XML style single tags</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Check to use XML style single tags (<b>&lt;single_tag /&gt;</b>), otherwise HTML style single tags (<b>&lt;single_tag&gt;</b>) are used.</string> + </property> + </widget> + <widget class="QCheckBox" row="5" column="0" rowspan="1" colspan="7"> + <property name="name"> + <cstring>useCommonRules</cstring> + </property> + <property name="text"> + <string>Use common rules</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="toolTip" stdset="0"> + <string>Append common parsing rules</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Check it to append common parsing rules. These are: +<p><b> +&nbsp;&nbsp;SpecialAreas=&lt;?xml ?&gt;, &lt;!-- --&gt;, &lt;! &gt; +&nbsp;&nbsp;SpecialAreaNames = XML PI, comment, DTD +&nbsp;&nbsp;Comments = &lt;!-- --&gt; +</b></p></string> + </property> + </widget> + <widget class="QCheckBox" row="3" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>extendedBooleans</cstring> + </property> + <property name="text"> + <string>Extended booleans</string> + </property> + <property name="toolTip" stdset="0"> + <string>Check if the booleans are stored in extended form</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Check if you want extended booleans in the language.<br> +Examples:<br> +<i>Simple boolean</i>: <b>&lt;tag&nbsp;booleanAttr&gt;</b><br> +<i>Extended boolean</i>: <b>&lt;tag&nbsp;booleanAttr="1"&gt;</b> or <b>&lt;tag&nbsp;booleanAttr="true"&gt;</b>. +<br> +See the <b>True</b> and <b>False</b> boxes to define the values for true and false.</string> + </property> + </widget> + <widget class="KLineEdit" row="3" column="6"> + <property name="name"> + <cstring>falseEdit</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>2</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="toolTip" stdset="0"> + <string>The value of "true" in case of extended booleans</string> + </property> + </widget> + <widget class="KLineEdit" row="3" column="4"> + <property name="name"> + <cstring>trueEdit</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>2</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="toolTip" stdset="0"> + <string>The value of "true" in case of extended booleans</string> + </property> + </widget> + <widget class="QLabel" row="3" column="5"> + <property name="name"> + <cstring>textLabel39</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>False:</string> + </property> + <property name="alignment"> + <set>AlignVCenter|AlignRight</set> + </property> + </widget> + <widget class="QLabel" row="3" column="3"> + <property name="name"> + <cstring>textLabel38</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>True:</string> + </property> + <property name="alignment"> + <set>AlignVCenter|AlignRight</set> + </property> + </widget> + <spacer row="3" column="2"> + <property name="name"> + <cstring>spacer12</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="KLineEdit" row="0" column="1" rowspan="1" colspan="6"> + <property name="name"> + <cstring>specialAreasEdit</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Comma separated list of the beginning and closing string for special areas</string> + </property> + <property name="whatsThis" stdset="0"> + <string>The beginning and closing string of special areas, separated by a comma.<br> + Special areas are not parsed according to this DTD's rules, but according to their own rules.<br> + A special area can be a pseudo DTD, a comment or something like that, for example <i>&lt;!--&nbsp;--&gt;</i>.</string> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel27</cstring> + </property> + <property name="text"> + <string>Special areas:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>kLineEdit11</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Comma separated list of the beginning and closing string for special areas</string> + </property> + <property name="whatsThis" stdset="0"> + <string>The beginning and closing string of special areas, separated by a comma.<br> + Special areas are not parsed according to this DTD's rules, but according to their own rules.<br> + A special area can be a pseudo DTD, a comment or something like that, for example <i>&lt;!--&nbsp;--&gt;</i>.</string> + </property> + </widget> + <widget class="KLineEdit" row="1" column="1" rowspan="1" colspan="6"> + <property name="name"> + <cstring>specialAreaNamesEdit</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Comma-separated list of the names for the above-defined special areas</string> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>textLabel28</cstring> + </property> + <property name="text"> + <string>Special area names:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>kLineEdit12</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Comma-separated list of the names for the above-defined special areas</string> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>textLabel40</cstring> + </property> + <property name="text"> + <string>Special tags:</string> + </property> + <property name="toolTip" stdset="0"> + <string>Specifies a tag that defines the start of a special area</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Specifies a tag which defines the start of a special area in the form of <i>tagname(attributename)</i>.<br> +Example:<b>script(language)</b> means that any <b>&lt;script&gt;</b> tag having a <b>language</b> attribute indicates a special area.</string> + </property> + </widget> + <widget class="KLineEdit" row="2" column="1" rowspan="1" colspan="6"> + <property name="name"> + <cstring>specialTagsEdit</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Specifies a tag that defines the start of a special area</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Specifies a tag which defines the start of a special area in the form of <i>tagname(attributename)</i>.<br> +Example:<b>script(language)</b> means that any <b>&lt;script&gt;</b> tag having a <b>language</b> attribute indicates a special area.</string> + </property> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>WStackPage</cstring> + </property> + <attribute name="id"> + <number>1</number> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>textLabel21</cstring> + </property> + <property name="text"> + <string>Definition tags:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>kLineEdit14</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Tags and attributes defining this DTEP</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Comma separated list of tags that define this DTEP. The format used is <i>tagname(attribute[defaultvalue])</i>. If the parent (a real) DTEP has a tag with <i>tagname</i> and +the <i>attribute value</i> of this tag is equal with the name of this DTEP, the tag area +is parsed according to the rules of this DTEP.<br> +If <i>[defaultvalue]</i> is present, it means that if the attribute is not present in the tag it is taken as present with <i>value = defaultvalue</i>.<br> +Example: <b>Tags=style(type[text/css])</b> means that both <b>&lt;style&gt;</b> and <b>&lt;style&nbsp;type="text/css"&gt;</b> are treated the same way and the DTEP defined by this tag is named <b>text/css</b>.</string> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel20</cstring> + </property> + <property name="text"> + <string>Area borders:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>kLineEdit13</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Comma separated list of the area borders</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Comma separated list of the area borders encapsulating this pseudo DTEP. In the case of PHP it is:<br> +<b>&lt;?&nbsp;?&gt;,&nbsp;&lt;*&nbsp;*&gt;,&nbsp;&lt;%&nbsp;%&gt;</b></string> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>textLabel22</cstring> + </property> + <property name="text"> + <string>Structure keywords:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>kLineEdit15</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Comma separated list of structure keywords</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Comma separated list of structure keywords. The keywords used here are used to create new node (nodes for structures) in the structure tree, like for a function, class or if block.</string> + </property> + </widget> + <widget class="QLabel" row="5" column="0"> + <property name="name"> + <cstring>textLabel26</cstring> + </property> + <property name="text"> + <string>Structure delimiting:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>kLineEdit19</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Regular expression that finds the beginning or end of a structure</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Regular expression that finds the beginning or end of a structure. This is usually the combination of <b>Structure beginning</b> and <b>Structure end</b>, like <b>\{&nbsp;|&nbsp;\}</b></string> + </property> + </widget> + <widget class="QLabel" row="4" column="0"> + <property name="name"> + <cstring>textLabel24</cstring> + </property> + <property name="text"> + <string>Structure beginning:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>kLineEdit17</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>A string specifying the beginning of a structure</string> + </property> + <property name="whatsThis" stdset="0"> + <string>A string specifying the beginning of a structure, like <b>{</b> in many cases.</string> + </property> + </widget> + <widget class="QLabel" row="3" column="0"> + <property name="name"> + <cstring>textLabel23</cstring> + </property> + <property name="text"> + <string>Local scope keywords:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>kLineEdit16</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Comma separated list of the local scope defining keywords</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Comma separated list of the local scope defining keywords. Other structure group elements found under a structure node that was created based on a keyword from this list are treated as local elements. For example if this list contains <b>function</b>, it means that elements, like variables found under a <b>function</b> are local, relative to the node that holds the <b>function</b>.</string> + </property> + </widget> + <widget class="KLineEdit" row="3" column="1" rowspan="1" colspan="3"> + <property name="name"> + <cstring>localStructKeywordsEdit</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Comma separated list of the local scope defining keywords</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Comma separated list of the local scope defining keywords. Other structure group elements found under a structure node that was created based on a keyword from this list are treated as local elements. For example if this list contains <b>function</b>, it means that elements, like variables found under a <b>function</b> are local, relative to the node that holds the <b>function</b>.</string> + </property> + </widget> + <widget class="KLineEdit" row="2" column="1" rowspan="1" colspan="3"> + <property name="name"> + <cstring>structKeywordsEdit</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Comma separated list of structure keywords</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Comma separated list of structure keywords. The keywords used here are used to create new node (nodes for structures) in the structure tree, like for a function, class or if block.</string> + </property> + </widget> + <widget class="KLineEdit" row="1" column="1" rowspan="1" colspan="3"> + <property name="name"> + <cstring>definitionTagsEdit</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Tags and attributes defining this DTEP</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Comma separated list of tags that define this DTEP. The format used is <i>tagname(attribute[defaultvalue])</i>. If the parent (a real) DTEP has a tag with <i>tagname</i> and +the <i>attribute value</i> of this tag is equal with the name of this DTEP, the tag area +is parsed according to the rules of this DTEP.<br> +If <i>[defaultvalue]</i> is present, it means that if the attribute is not present in the tag it is taken as present with <i>value = defaultvalue</i>.<br> +Example: <b>Tags=style(type[text/css])</b> means that both <b>&lt;style&gt;</b> and <b>&lt;style&nbsp;type="text/css"&gt;</b> are treated the same way and the DTEP defined by this tag is named <b>text/css</b>.</string> + </property> + </widget> + <widget class="KLineEdit" row="0" column="1" rowspan="1" colspan="3"> + <property name="name"> + <cstring>areaBordersEdit</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Comma separated list of the area borders</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Comma separated list of the area borders encapsulating this pseudo DTEP. In the case of PHP it is:<br> +<b>&lt;?&nbsp;?&gt;,&nbsp;&lt;*&nbsp;*&gt;,&nbsp;&lt;%&nbsp;%&gt;</b></string> + </property> + </widget> + <widget class="KLineEdit" row="4" column="3"> + <property name="name"> + <cstring>structEndEdit</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>A string specifying the end of a structure</string> + </property> + <property name="whatsThis" stdset="0"> + <string>A string specifying the end of a structure, like <b>}</b> in many cases.</string> + </property> + </widget> + <widget class="QLabel" row="4" column="2"> + <property name="name"> + <cstring>textLabel25</cstring> + </property> + <property name="text"> + <string>Structure end:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>kLineEdit18</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>A string specifying the end of a structure</string> + </property> + <property name="whatsThis" stdset="0"> + <string>A string specifying the end of a structure, like <b>}</b> in many cases.</string> + </property> + </widget> + <widget class="KLineEdit" row="4" column="1"> + <property name="name"> + <cstring>structBeginEdit</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>A string specifying the beginning of a structure</string> + </property> + <property name="whatsThis" stdset="0"> + <string>A string specifying the beginning of a structure, like <b>{</b> in many cases.</string> + </property> + </widget> + <widget class="QLabel" row="7" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>textLabel19</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Complete class members after:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>kLineEdit21</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Regular expression to find out when to invoke member autocompletion</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Regular expression to find out when to invoke member autocompletion. <br> +Example:<br> +- we have a class called <b>foo</b> with some member variables<br> +- the object of type <b>foo</b> is used in the document as $<b>objFoo</b><br> +- the members can appear as <b>$objFoo->member</b> or <b>$objFoo.member</b> +- in the above case this entry should look like <b>(?:-&gt;|\.)$</b> (autocomplete if the object is followed by <b>-&gt;</b> or <b>.</b>)<br> + The regular expression must be terminated with <b>$</b> (match end of line).</string> + </property> + </widget> + <widget class="QLabel" row="6" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>textLabel18</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Complete attributes after:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>kLineEdit20</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Autocomplete attributes after this character. See the information for the same entry valid for tags.</string> + </property> + </widget> + <widget class="KLineEdit" row="6" column="2" rowspan="1" colspan="2"> + <property name="name"> + <cstring>attributesAfterEdit</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Autocomplete attributes after this character. See the information for the same entry valid for tags.</string> + </property> + </widget> + <widget class="KLineEdit" row="7" column="2" rowspan="1" colspan="2"> + <property name="name"> + <cstring>membersAfterEdit</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Regular expression to find out when to invoke member autocompletion</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Regular expression to find out when to invoke member autocompletion. <br> +Example:<br> +- we have a class called <b>foo</b> with some member variables<br> +- the object of type <b>foo</b> is used in the document as $<b>objFoo</b><br> +- the members can appear as <b>$objFoo->member</b> or <b>$objFoo.member</b> +- in the above case this entry shoul look like <b>(?:-&gt;|\.)$</b> (autocomplete if the object is followed by <b>-&gt;</b> or <b>.</b>)<br> + The regular expression must be terminated with <b>$</b> (match end of line).</string> + </property> + </widget> + <widget class="KLineEdit" row="5" column="1" rowspan="1" colspan="3"> + <property name="name"> + <cstring>structRxEdit</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Regular expression that finds the beginning or end of a structure</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Regular expression that finds the beginning or end of a structure. This is usually the combination of <b>Structure beginning</b> and <b>Structure end</b>, like <b>\{&nbsp;|&nbsp;\}</b></string> + </property> + </widget> + </grid> + </widget> + </widget> + </grid> + </widget> + <widget class="QLabel" row="3" column="0"> + <property name="name"> + <cstring>textLabel15</cstring> + </property> + <property name="text"> + <string>Attribute separator:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>kLineEdit22</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>The character specifying the end of an attribute</string> + </property> + <property name="whatsThis" stdset="0"> + <string>The character specifying the end of an attribute. By default it is <b>"</b> for XML DTEPs and <b>,</b> for pseudo DTEPs.</string> + </property> + </widget> + <widget class="KLineEdit" row="2" column="1" rowspan="1" colspan="4"> + <property name="name"> + <cstring>commentsEdit</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Comma separated list of area borders for comments</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Comma separated list of area borders for comments. <i>EOL</i> means end of line, used for single line comments.<br> +Example: <b>//&nbsp;EOL,&nbsp;/*&nbsp;*/</b></string> + </property> + </widget> + <widget class="QLabel" row="5" column="0"> + <property name="name"> + <cstring>textLabel17</cstring> + </property> + <property name="text"> + <string>Included DTEPs:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>kLineEdit25</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Comma-separated list of DTEPs that can be present inside this DTEP</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Comma-separated list of DTEPs that can be present inside this DTEP. The list consist usually of pseudo DTEPs.</string> + </property> + </widget> + <widget class="QLabel" row="4" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>textLabel16</cstring> + </property> + <property name="text"> + <string>Autocomplete tags after:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>kLineEdit24</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>The character after which the list of tags should be shown</string> + </property> + <property name="whatsThis" stdset="0"> + <string>The autocompletion box is brought up automatically once this character is entered or space is pressed after this character.<br> For real DTEPs it's usually <b>&lt;</b>, but for example for the CSS pseudo DTEP it is <b>{</b>. The text <b>none</b> instead of a character specifies that the tag completion box should not be brought up automatically, only if the user requests it.</string> + </property> + </widget> + <widget class="KLineEdit" row="4" column="2" rowspan="1" colspan="3"> + <property name="name"> + <cstring>tagAfterEdit</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>The character after which the list of tags should be shown</string> + </property> + <property name="whatsThis" stdset="0"> + <string>The autocompletion box is brought up automatically once this character is entered or space is pressed after this character<br>. For real DTEPs it's usually <b>&lt;</b>, but for example for the CSS pseudo DTEP it is <b>{</b>. The text <b>none</b> instead of a character specifies that the tag completion box should not be brought up automatically, only if the user requests it.</string> + </property> + </widget> + <widget class="KLineEdit" row="3" column="4"> + <property name="name"> + <cstring>tagSeparatorEdit</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="toolTip" stdset="0"> + <string>The character specifying the end of a tag. See the information for the attribute separator for details.</string> + </property> + </widget> + <widget class="QLabel" row="3" column="3"> + <property name="name"> + <cstring>textLabel14</cstring> + </property> + <property name="text"> + <string>Tag separator:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>kLineEdit23</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>The character specifying the end of a tag. See the information for the attribute separator for details.</string> + </property> + </widget> + <widget class="KLineEdit" row="3" column="1" rowspan="1" colspan="2"> + <property name="name"> + <cstring>attributeSeparatorEdit</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>The character specifying the end of an attribute</string> + </property> + <property name="whatsThis" stdset="0"> + <string>The character specifying the end of an attribute. By default it is <b>"</b> for XML DTEPs and <b>,</b> for pseudo DTEPs.</string> + </property> + </widget> + <widget class="KLineEdit" row="5" column="2" rowspan="1" colspan="3"> + <property name="name"> + <cstring>mayContainEdit</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Comma-separated list of DTEPs that can be present inside this DTEP</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Comma-separated list of DTEPs that can be present inside this DTEP. The list consist usually of pseudo DTEPs.</string> + </property> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>TabPage</cstring> + </property> + <attribute name="title"> + <string>Structures</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel29</cstring> + </property> + <property name="text"> + <string>Available groups:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>listBox1</cstring> + </property> + </widget> + <spacer row="3" column="1"> + <property name="name"> + <cstring>spacer5</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>270</height> + </size> + </property> + </spacer> + <widget class="KPushButton" row="2" column="0"> + <property name="name"> + <cstring>addStructButton</cstring> + </property> + <property name="text"> + <string>&Add...</string> + </property> + </widget> + <widget class="KPushButton" row="2" column="1"> + <property name="name"> + <cstring>editStructButton</cstring> + </property> + <property name="text"> + <string>&Edit...</string> + </property> + </widget> + <widget class="KPushButton" row="2" column="2"> + <property name="name"> + <cstring>deleteStructButton</cstring> + </property> + <property name="text"> + <string>&Delete</string> + </property> + </widget> + <widget class="QListBox" row="1" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>structuresList</cstring> + </property> + </widget> + </grid> + </widget> + </widget> + </grid> +</widget> +<connections> + <connection> + <sender>enablePage1</sender> + <signal>toggled(bool)</signal> + <receiver>textLabel11</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>enablePage1</sender> + <signal>toggled(bool)</signal> + <receiver>pageTitleEdit1</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>enablePage1</sender> + <signal>toggled(bool)</signal> + <receiver>groupsEdit1</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>enablePage1</sender> + <signal>toggled(bool)</signal> + <receiver>textLabel12</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>enablePage1</sender> + <signal>toggled(bool)</signal> + <receiver>enablePage2</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>enablePage2</sender> + <signal>toggled(bool)</signal> + <receiver>pageTitleEdit2</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>enablePage2</sender> + <signal>toggled(bool)</signal> + <receiver>groupsEdit2</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>enablePage2</sender> + <signal>toggled(bool)</signal> + <receiver>textLabel11_2</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>enablePage2</sender> + <signal>toggled(bool)</signal> + <receiver>textLabel12_2</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>enablePage2</sender> + <signal>toggled(bool)</signal> + <receiver>enablePage3</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>enablePage3</sender> + <signal>toggled(bool)</signal> + <receiver>pageTitleEdit3</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>enablePage3</sender> + <signal>toggled(bool)</signal> + <receiver>groupsEdit3</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>enablePage3</sender> + <signal>toggled(bool)</signal> + <receiver>textLabel11_3</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>enablePage3</sender> + <signal>toggled(bool)</signal> + <receiver>textLabel12_3</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>enablePage3</sender> + <signal>toggled(bool)</signal> + <receiver>enablePage4</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>enablePage4</sender> + <signal>toggled(bool)</signal> + <receiver>pageTitleEdit4</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>enablePage4</sender> + <signal>toggled(bool)</signal> + <receiver>groupsEdit4</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>enablePage4</sender> + <signal>toggled(bool)</signal> + <receiver>textLabel11_3_2</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>enablePage4</sender> + <signal>toggled(bool)</signal> + <receiver>textLabel12_3_2</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>enablePage4</sender> + <signal>toggled(bool)</signal> + <receiver>enablePage5</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>enablePage5</sender> + <signal>toggled(bool)</signal> + <receiver>pageTitleEdit5</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>enablePage5</sender> + <signal>toggled(bool)</signal> + <receiver>groupsEdit5</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>enablePage5</sender> + <signal>toggled(bool)</signal> + <receiver>textLabel11_5</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>enablePage5</sender> + <signal>toggled(bool)</signal> + <receiver>textLabel12_5</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>typeCombo</sender> + <signal>activated(int)</signal> + <receiver>rulesWidgetStack</receiver> + <slot>raiseWidget(int)</slot> + </connection> + <connection> + <sender>addStructButton</sender> + <signal>clicked()</signal> + <receiver>DTEPEditDlgS</receiver> + <slot>slotAddStructGroup()</slot> + </connection> + <connection> + <sender>deleteStructButton</sender> + <signal>clicked()</signal> + <receiver>DTEPEditDlgS</receiver> + <slot>slotDeleteStructGroup()</slot> + </connection> + <connection> + <sender>editStructButton</sender> + <signal>clicked()</signal> + <receiver>DTEPEditDlgS</receiver> + <slot>slotEditStructGroup()</slot> + </connection> + <connection> + <sender>typeCombo</sender> + <signal>activated(int)</signal> + <receiver>generalWidgetStack</receiver> + <slot>raiseWidget(int)</slot> + </connection> + <connection> + <sender>typeCombo</sender> + <signal>activated(int)</signal> + <receiver>DTEPEditDlgS</receiver> + <slot>slotFamilyChanged(int)</slot> + </connection> + <connection> + <sender>extendedBooleans</sender> + <signal>toggled(bool)</signal> + <receiver>textLabel38</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>extendedBooleans</sender> + <signal>toggled(bool)</signal> + <receiver>trueEdit</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>extendedBooleans</sender> + <signal>toggled(bool)</signal> + <receiver>textLabel39</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>extendedBooleans</sender> + <signal>toggled(bool)</signal> + <receiver>falseEdit</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>structuresList</sender> + <signal>doubleClicked(QListBoxItem*)</signal> + <receiver>editStructButton</receiver> + <slot>animateClick()</slot> + </connection> +</connections> +<tabstops> + <tabstop>tabWidget</tabstop> + <tabstop>nameEdit</tabstop> + <tabstop>nickNameEdit</tabstop> + <tabstop>inheritsCombo</tabstop> + <tabstop>typeCombo</tabstop> + <tabstop>mimeTypeEdit</tabstop> + <tabstop>extensionEdit</tabstop> + <tabstop>toolbarFolderEdit</tabstop> + <tabstop>toolbarsEdit</tabstop> + <tabstop>caseSensitive</tabstop> + <tabstop>topLevel</tabstop> + <tabstop>urlEdit</tabstop> + <tabstop>doctypeEdit</tabstop> + <tabstop>enablePage1</tabstop> + <tabstop>pageTitleEdit1</tabstop> + <tabstop>groupsEdit1</tabstop> + <tabstop>enablePage2</tabstop> + <tabstop>pageTitleEdit2</tabstop> + <tabstop>groupsEdit2</tabstop> + <tabstop>enablePage3</tabstop> + <tabstop>pageTitleEdit3</tabstop> + <tabstop>groupsEdit3</tabstop> + <tabstop>enablePage4</tabstop> + <tabstop>pageTitleEdit4</tabstop> + <tabstop>groupsEdit4</tabstop> + <tabstop>enablePage5</tabstop> + <tabstop>pageTitleEdit5</tabstop> + <tabstop>groupsEdit5</tabstop> + <tabstop>areaBordersEdit</tabstop> + <tabstop>definitionTagsEdit</tabstop> + <tabstop>structKeywordsEdit</tabstop> + <tabstop>localStructKeywordsEdit</tabstop> + <tabstop>structBeginEdit</tabstop> + <tabstop>structEndEdit</tabstop> + <tabstop>structRxEdit</tabstop> + <tabstop>attributesAfterEdit</tabstop> + <tabstop>membersAfterEdit</tabstop> + <tabstop>specialAreasEdit</tabstop> + <tabstop>specialAreaNamesEdit</tabstop> + <tabstop>specialTagsEdit</tabstop> + <tabstop>extendedBooleans</tabstop> + <tabstop>trueEdit</tabstop> + <tabstop>falseEdit</tabstop> + <tabstop>xmlStyleTags</tabstop> + <tabstop>useCommonRules</tabstop> + <tabstop>enableMinusInWords</tabstop> + <tabstop>commentsEdit</tabstop> + <tabstop>attributeSeparatorEdit</tabstop> + <tabstop>tagSeparatorEdit</tabstop> + <tabstop>tagAfterEdit</tabstop> + <tabstop>mayContainEdit</tabstop> + <tabstop>structuresList</tabstop> + <tabstop>addStructButton</tabstop> + <tabstop>editStructButton</tabstop> + <tabstop>deleteStructButton</tabstop> +</tabstops> +<slots> + <slot access="protected">slotEditStructGroup()</slot> + <slot>slotAddStructGroup()</slot> + <slot>slotDeleteStructGroup()</slot> + <slot>slotFamilyChanged(int)</slot> +</slots> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/quanta/dialogs/dtepstructureeditdlgs.ui b/quanta/dialogs/dtepstructureeditdlgs.ui new file mode 100644 index 00000000..12abe665 --- /dev/null +++ b/quanta/dialogs/dtepstructureeditdlgs.ui @@ -0,0 +1,646 @@ +<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> +<class>DTEPStructureEditDlgS</class> +<comment>/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; version 2 of the License. * + * * + ***************************************************************************/ +</comment> +<author>(C) 2005 Andras Mantia <amantia@kde.org></author> +<widget class="QWidget"> + <property name="name"> + <cstring>DTEPStructureEditDlgS</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>628</width> + <height>666</height> + </rect> + </property> + <property name="caption"> + <string>Structure Group Editor</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel30</cstring> + </property> + <property name="text"> + <string>&Name:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>nameEdit</cstring> + </property> + </widget> + <widget class="KLineEdit" row="0" column="1" rowspan="1" colspan="3"> + <property name="name"> + <cstring>nameEdit</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>The name of the group</string> + </property> + <property name="whatsThis" stdset="0"> + <string>The user visible name of the group. It will be shown in the structure tree as a top node when there are elements belonging to this group in the document.</string> + </property> + </widget> + <widget class="QLabel" row="0" column="4"> + <property name="name"> + <cstring>textLabel32</cstring> + </property> + <property name="text"> + <string>&Icon:</string> + </property> + <property name="alignment"> + <set>AlignVCenter|AlignRight</set> + </property> + <property name="buddy" stdset="0"> + <cstring>iconButton</cstring> + </property> + </widget> + <widget class="KIconButton" row="0" column="5" rowspan="2" colspan="1"> + <property name="name"> + <cstring>iconButton</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>50</width> + <height>50</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>50</width> + <height>50</height> + </size> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="QLabel" row="5" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>textLabel34</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Filen&ame definition:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>fileNameRxEdit</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Regular expression to get the filename</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Regular expression to get the filename. The expression is used to <b>remove</b> the unnecessary strings from the element's text.</string> + </property> + </widget> + <widget class="QCheckBox" row="4" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>hasFilename</cstring> + </property> + <property name="text"> + <string>Contains a &filename</string> + </property> + <property name="toolTip" stdset="0"> + <string>True if the element's text contains a filename</string> + </property> + </widget> + <widget class="KLineEdit" row="5" column="2" rowspan="1" colspan="4"> + <property name="name"> + <cstring>fileNameRxEdit</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip" stdset="0"> + <string>Regular expression to get the filename</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Regular expression to get the filename. The expression is used to <b>remove</b> the unnecessary strings from the element's text.</string> + </property> + </widget> + <widget class="QLabel" row="3" column="0"> + <property name="name"> + <cstring>textLabel33</cstring> + </property> + <property name="text"> + <string>&Tag:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>tagEdit</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Elements identified by this entry will belong to this group</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Defines which tags belong to this group. The format is <i>tagname(attribute1, attribute2, ...)</i>. Tags with name <i>tagname</i> will appear under this group. The item text of the corresponding node in the tree will be <i>attribute1_value | attribute2_value | ...</i>Currently only one tag may be listed here.</string> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>textLabel31</cstring> + </property> + <property name="text"> + <string>"No" na&me:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>noNameEdit</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>The name that appears when no element were found</string> + </property> + <property name="whatsThis" stdset="0"> + <string>The user visible name of the group. It will be shown in the structure tree as a top node when there are <b>no</b> elements belonging to this group in the document.</string> + </property> + </widget> + <widget class="KLineEdit" row="2" column="1" rowspan="1" colspan="5"> + <property name="name"> + <cstring>noNameEdit</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>The name that appears when no element were found</string> + </property> + <property name="whatsThis" stdset="0"> + <string>The user visible name of the group. It will be shown in the structure tree as a top node when there are <b>no</b> elements belonging to this group in the document.</string> + </property> + </widget> + <widget class="KLineEdit" row="3" column="1" rowspan="1" colspan="5"> + <property name="name"> + <cstring>tagEdit</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="toolTip" stdset="0"> + <string>Elements ideintified by this entry will belong to this group</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Defines which tags belong to this group. The format is <i>tagname(attribute1, attribute2, ...)</i>. Tags with name <i>tagname</i> will appear under this group. The item text of the corresponding node in the tree will be <i>attribute1_value | attribute2_value | ...</i>Currently only one tag may be listed here.</string> + </property> + </widget> + <spacer row="1" column="3"> + <property name="name"> + <cstring>spacer6</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Fixed</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>16</height> + </size> + </property> + </spacer> + <widget class="QCheckBox" row="6" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>appendToTags</cstring> + </property> + <property name="text"> + <string>Use elements as tags</string> + </property> + <property name="toolTip" stdset="0"> + <string>Treat elements as new tags</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Treat elements as new tags, so they will show up during tag autocompletion.</string> + </property> + </widget> + <widget class="QGroupBox" row="7" column="0" rowspan="1" colspan="6"> + <property name="name"> + <cstring>pseudoGroupBox</cstring> + </property> + <property name="title"> + <string>&Pseudo DTEP Specific Settings</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KLineEdit" row="4" column="1" rowspan="1" colspan="4"> + <property name="name"> + <cstring>typeRxEdit</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Regular expression to find the type of the element</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Regular expression to find the type of the element. The pattern is searched on the result of the <i>DefinitionRx</i> match and the first captured area will hold the element type.<br> +Example (simplified):<br> +<b>DefinitionRx=\$+([a-zA-Z]+)=new\\s[a-zA-Z]+;<br> +TypeRx=new\\s([a-zA-Z]+);</b><br><br> +This will match strings like <b>$fooObj=new foo;</b>. Now this string is searched and it will find <b>new foo;</b>, where <b>foo</b> is the first captured text (the regular expression matching <b>foo</b> is between brackets).<br> +So the type of <b>$fooObj</b> is <b>foo</b>.</string> + </property> + </widget> + <widget class="QLabel" row="3" column="0"> + <property name="name"> + <cstring>textLabel36</cstring> + </property> + <property name="text"> + <string>&Usage expression:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>usageRxEdit</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Regular expression to find the usage of a group element</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Regular expression to find the usage of a group element in the document.<br> +Example 1:<br> +- classes are defined as <b>class foo {...}</b><br> +- classes are used as <b>$objFoo</b><br><br> +Example 2:<br> +- variables are defined as <b>int i</b><br> +- variables are used as <b>@i</b><br><br> +Example 3:<br> +- variables are defined as <b>$i</b><br> +- variables are used as <b>$i</b>. In this case <i>UsageRx </i>is the same as <i>DefinitionRx</i>.</string> + </property> + </widget> + <widget class="QLabel" row="4" column="0"> + <property name="name"> + <cstring>textLabel37</cstring> + </property> + <property name="text"> + <string>Element t&ype expression:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>typeRxEdit</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Regular expression to find the type of the element</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Regular expression to find the type of the element. The pattern is searched on the result of the <i>DefinitionRx</i> match and the first captured area will hold the element type.<br> +Example (simplified):<br> +<b>DefinitionRx=\$+([a-zA-Z]+)=new\\s[a-zA-Z]+;<br> +TypeRx=new\\s([a-zA-Z]+);</b><br><br> +This will match strings like <b>$fooObj=new foo;</b>. Now this string is searched and it will find <b>new foo;</b>, where <b>foo</b> is the first captured text (the regular expression matching <b>foo</b> is between brackets).<br> +So the type of <b>$fooObj</b> is <b>foo</b>.</string> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>textLabel35</cstring> + </property> + <property name="text"> + <string>Definition e&xpression:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>definitionRxEdit</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Regular expression to find what belong to this group</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Regular expression used to find text areas in the document, which will belong to this group. The first captured area shouldbe the actual name of the group entry.<br> +Example for a <i>class</i> group:<br> +<b>\bclass[\\s]+([0-9a-zA-Z_\x7f-\xff]*)[\\s]*</b><br> +The first captured area (between "<b>(</b>" and "<b>)</b>") holds the class name.</string> + </property> + </widget> + <widget class="KLineEdit" row="3" column="1" rowspan="1" colspan="4"> + <property name="name"> + <cstring>usageRxEdit</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Regular expression to find the usage of a group element</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Regular expression to find the usage of a group element in the document.<br> +Example 1:<br> +- classes are defined as <b>class foo {...}</b><br> +- classes are used as <b>$objFoo</b><br><br> +Example 2:<br> +- variables are defined as <b>int i</b><br> +- variables are used as <b>@i</b><br><br> +Example 3:<br> +- variables are defined as <b>$i</b><br> +- variables are used as <b>$i</b>. In this case <i>UsageRx </i>is the same as <i>DefinitionRx</i>.</string> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel41</cstring> + </property> + <property name="text"> + <string>Parent group:</string> + </property> + <property name="toolTip" stdset="0"> + <string>The name of the group that may be the parent of this</string> + </property> + <property name="whatsThis" stdset="0"> + <string>The name of the group that may be the parent of this. For example <b>classes</b> might be a parent of <b>functions</b> in case of member functions. This entry indicates this possible relationship and is used to provide functionality like member autocompletion.</string> + </property> + </widget> + <widget class="KLineEdit" row="0" column="1" rowspan="1" colspan="4"> + <property name="name"> + <cstring>parentGroupEdit</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>The name of the group that may be the parent of this</string> + </property> + <property name="whatsThis" stdset="0"> + <string>The name of the group that may be the parent of this. For example <b>classes</b> might be a parent of <b>functions</b> in case of member functions. This entry indicates this possible relationship and is used to provide functionality like member autocompletion.</string> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>textLabel42</cstring> + </property> + <property name="text"> + <string>Searched tags:</string> + </property> + <property name="toolTip" stdset="0"> + <string>Only tags of this type can be part of the group</string> + </property> + </widget> + <widget class="QLabel" row="6" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>textLabel44</cstring> + </property> + <property name="text"> + <string>Remove when autocompleting:</string> + </property> + <property name="toolTip" stdset="0"> + <string>Regular expression used to remove unwanted strings from the completion text</string> + </property> + </widget> + <widget class="QLabel" row="5" column="0"> + <property name="name"> + <cstring>textLabel43</cstring> + </property> + <property name="text"> + <string>Autocomplete after:</string> + </property> + <property name="toolTip" stdset="0"> + <string>Regular expression to tell when to bring up the completion box with the elements of this group</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Regular expression to tell when to bring up the completion box with the elements of this group.<br> +Example:<b>\bnew[\\s]+$</b> tells that after typing <b>new&nbsp;</b>, the completion box with the elements should be shown.</string> + </property> + </widget> + <widget class="KLineEdit" row="5" column="2" rowspan="1" colspan="3"> + <property name="name"> + <cstring>autoCompleteRxEdit</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Regular expression to tell when to bring up the completion box with the elements of this group</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Regular expression to tell when to bring up the completion box with the elements of this group.<br> +Example:<b>\bnew[\\s]+$</b> tells that after typing <b>new&nbsp;</b>, the completion box with the elements should be shown.</string> + </property> + </widget> + <widget class="KLineEdit" row="6" column="2" rowspan="1" colspan="3"> + <property name="name"> + <cstring>removeRxEdit</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Regular expression used to remove unwanted strings from the completion text</string> + </property> + </widget> + <widget class="KComboBox" row="1" column="1" rowspan="1" colspan="2"> + <item> + <property name="text"> + <string>Text</string> + </property> + </item> + <item> + <property name="text"> + <string>XmlTag</string> + </property> + </item> + <item> + <property name="text"> + <string>XmlTagEnd</string> + </property> + </item> + <item> + <property name="text"> + <string>Comment</string> + </property> + </item> + <item> + <property name="text"> + <string>CSS</string> + </property> + </item> + <item> + <property name="text"> + <string>ScriptTag</string> + </property> + </item> + <item> + <property name="text"> + <string>ScriptStructureBegin</string> + </property> + </item> + <item> + <property name="text"> + <string>ScriptStructureEnd</string> + </property> + </item> + <property name="name"> + <cstring>tagTypeCombo</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Only tags of this type can be part of the group</string> + </property> + </widget> + <spacer row="1" column="3" rowspan="1" colspan="2"> + <property name="name"> + <cstring>spacer13</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>340</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QCheckBox" row="7" column="0"> + <property name="name"> + <cstring>parseFile</cstring> + </property> + <property name="text"> + <string>Parse file</string> + </property> + <property name="toolTip" stdset="0"> + <string>Check if the filename that is in the elements text should be parsed</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Check if the filename that is in the elements text should be parsed. This makes sense only if the element may contain a filename and the <i>FileNameRx</i> is specified.</string> + </property> + </widget> + <widget class="QButtonGroup" row="8" column="0" rowspan="1" colspan="5"> + <property name="name"> + <cstring>buttonGroup1</cstring> + </property> + <property name="title"> + <string>Type</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QRadioButton" row="0" column="0"> + <property name="name"> + <cstring>simpleGroup</cstring> + </property> + <property name="text"> + <string>Simple</string> + </property> + <property name="toolTip" stdset="0"> + <string>This is a simple group, nothing special</string> + </property> + </widget> + <widget class="QRadioButton" row="1" column="0"> + <property name="name"> + <cstring>variableGroup</cstring> + </property> + <property name="text"> + <string>Variable group</string> + </property> + <property name="toolTip" stdset="0"> + <string>The group's elements are variables</string> + </property> + </widget> + <widget class="QRadioButton" row="0" column="1"> + <property name="name"> + <cstring>functionGroup</cstring> + </property> + <property name="text"> + <string>Function group</string> + </property> + <property name="toolTip" stdset="0"> + <string>The group's elements are functions</string> + </property> + </widget> + <widget class="QRadioButton" row="1" column="1"> + <property name="name"> + <cstring>classGroup</cstring> + </property> + <property name="text"> + <string>Class group</string> + </property> + <property name="toolTip" stdset="0"> + <string>The group's elements are classes</string> + </property> + </widget> + <widget class="QRadioButton" row="0" column="2"> + <property name="name"> + <cstring>objectGroup</cstring> + </property> + <property name="text"> + <string>Ob&ject group</string> + </property> + <property name="toolTip" stdset="0"> + <string>The group's elements are objects</string> + </property> + </widget> + </grid> + </widget> + <widget class="KLineEdit" row="2" column="1" rowspan="1" colspan="3"> + <property name="name"> + <cstring>definitionRxEdit</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Regular expression to find what belong to this group</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Regular expression used to find text areas in the document, which will belong to this group. The first captured area shouldbe the actual name of the group entry.<br> +Example for a <i>class</i> group:<br> +<b>\bclass[\\s]+([0-9a-zA-Z_\x7f-\xff]*)[\\s]*</b><br> +The first captured area (between "<b>(</b>" and "<b>)</b>") holds the class name.</string> + </property> + </widget> + <widget class="QCheckBox" row="2" column="4"> + <property name="name"> + <cstring>definitionRxMinimal</cstring> + </property> + <property name="text"> + <string>Minimal search mode</string> + </property> + <property name="toolTip" stdset="0"> + <string>Enable to use the minimal style search for definition instead of the standard (greedy) matching</string> + </property> + </widget> + </grid> + </widget> + </grid> +</widget> +<customwidgets> +</customwidgets> +<connections> + <connection> + <sender>hasFilename</sender> + <signal>toggled(bool)</signal> + <receiver>textLabel34</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>hasFilename</sender> + <signal>toggled(bool)</signal> + <receiver>fileNameRxEdit</receiver> + <slot>setEnabled(bool)</slot> + </connection> +</connections> +<tabstops> + <tabstop>nameEdit</tabstop> + <tabstop>iconButton</tabstop> + <tabstop>noNameEdit</tabstop> + <tabstop>tagEdit</tabstop> + <tabstop>hasFilename</tabstop> + <tabstop>fileNameRxEdit</tabstop> + <tabstop>appendToTags</tabstop> + <tabstop>parentGroupEdit</tabstop> + <tabstop>tagTypeCombo</tabstop> + <tabstop>definitionRxEdit</tabstop> + <tabstop>definitionRxMinimal</tabstop> + <tabstop>usageRxEdit</tabstop> + <tabstop>typeRxEdit</tabstop> + <tabstop>autoCompleteRxEdit</tabstop> + <tabstop>removeRxEdit</tabstop> + <tabstop>parseFile</tabstop> + <tabstop>simpleGroup</tabstop> + <tabstop>functionGroup</tabstop> + <tabstop>objectGroup</tabstop> + <tabstop>variableGroup</tabstop> + <tabstop>classGroup</tabstop> +</tabstops> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>kicondialog.h</includehint> +</includehints> +</UI> diff --git a/quanta/dialogs/filecombo.cpp b/quanta/dialogs/filecombo.cpp new file mode 100644 index 00000000..40415757 --- /dev/null +++ b/quanta/dialogs/filecombo.cpp @@ -0,0 +1,122 @@ +/*************************************************************************** + filecombo.cpp - description + ------------------- + begin : Wed Sep 27 2000 + copyright : (C) 2000 by Dmitry Poplavsky & Alexander Yakovlev & Eric Laffoon <pdima@users.sourceforge.net,yshurik@penguinpowered.com,sequitur@easystreet.com> + (C) 2002-2003 Andras Mantia <amantia@kde.org> + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +// QT includes +#include <qlayout.h> +#include <qcombobox.h> +#include <qpushbutton.h> + +// KDE includes +#include <klocale.h> +#include <kfiledialog.h> +#include <kurl.h> + +// app include +#include "filecombo.h" +#include "qextfileinfo.h" + +FileCombo::FileCombo(const KURL& a_baseURL, QWidget *parent, const char *name ) + :QWidget(parent,name) +{ + baseURL = a_baseURL; + m_absolutePath = false; + + QHBoxLayout *layout = new QHBoxLayout(this); + + combo = new QComboBox(true,this); + combo->setEditable(true); + button = new QPushButton(this); + + button ->setFixedSize(35,25); + button ->setText(i18n("...")); + + layout ->addWidget( combo ); + layout ->addWidget( button ); + + connect( button, SIGNAL(clicked()), this, SLOT(slotFileSelect()) ); + connect( combo, SIGNAL(activated(const QString&)), SLOT(slotComboActivated(const QString&))); + connect( combo, SIGNAL(textChanged(const QString&)), SLOT(slotComboActivated(const QString&))); + setFocusProxy(combo); +} + +FileCombo::FileCombo( QWidget *parent, const char *name ) + :QWidget( parent, name ) +{ + baseURL.setPath("."); + + QHBoxLayout *layout = new QHBoxLayout(this); + + combo = new QComboBox(true,this); + button = new QPushButton(this); + + button ->setFixedSize(35,25); + button ->setText(i18n("...")); + + layout ->addWidget( combo ); + layout ->addWidget( button ); + + connect( button, SIGNAL(clicked()), this, SLOT(slotFileSelect()) ); + connect( combo, SIGNAL(activated(const QString&)), SLOT(slotComboActivated(const QString&))); + connect( combo, SIGNAL(textChanged(const QString&)), SLOT(slotComboActivated(const QString&))); + setFocusProxy(combo); +} + +FileCombo::~FileCombo(){ +} + +QString FileCombo::text() const +{ + return combo->currentText(); +} + +void FileCombo::setText( const QString &_txt ) +{ + combo ->setEditText( _txt ); +} + +void FileCombo::slotFileSelect() +{ + KFileDialog *dlg = new KFileDialog(baseURL.url(), i18n("*|All Files"), this, "", true); + dlg->setMode(KFile::File | KFile::Directory | KFile::ExistingOnly); + dlg->exec(); + KURL url = dlg->selectedURL(); + delete dlg; + if ( !url.isEmpty() ) + { + if (!m_absolutePath) url = QExtFileInfo::toRelative(url, baseURL); + combo->setEditText( url.path() ); + } +} + +/** No descriptions */ +void FileCombo::setBaseURL(const KURL& a_baseURL) +{ + baseURL = a_baseURL; +} + +/** No descriptions */ +void FileCombo::setReturnAbsolutePath(bool absolutePath) +{ + m_absolutePath = absolutePath; +} + +void FileCombo::slotComboActivated(const QString&s) +{ + emit activated(s); +} + +#include "filecombo.moc" diff --git a/quanta/dialogs/filecombo.h b/quanta/dialogs/filecombo.h new file mode 100644 index 00000000..9403b808 --- /dev/null +++ b/quanta/dialogs/filecombo.h @@ -0,0 +1,62 @@ +/*************************************************************************** + filecombo.h - description + ------------------- + begin : Wed Sep 27 2000 + copyright : (C) 2000 by Dmitry Poplavsky & Alexander Yakovlev & Eric Laffoon <pdima@users.sourceforge.net,yshurik@penguinpowered.com,sequitur@easystreet.com> + (C) 2002 Andras Mantia <amantia@kde.org> + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef FILECOMBO_H +#define FILECOMBO_H + +#include <qwidget.h> +#include <kurl.h> + +/** + *@author Dmitry Poplavsky & Alexander Yakovlev & Eric Laffoon & Andras Mantia + */ + +class QComboBox; +class QPushButton; +class KURL; + +class FileCombo : public QWidget { + Q_OBJECT +public: + FileCombo(const KURL& a_baseURL, QWidget *parent=0, const char *name=0); + FileCombo(QWidget *parent=0, const char *name=0); + ~FileCombo(); + + QString text() const; + void setText( const QString &); + /** The select URL dialogs shows this URL, and the returned value is relative to this */ + void setBaseURL(const KURL& a_baseURL); + /** The selected URL will be stored with absolute path if absolutePath is true */ + void setReturnAbsolutePath(bool absolutePath); + +public slots: + void slotFileSelect(); + void slotComboActivated(const QString&); + +signals: + void activated(const QString&); + +protected: + KURL baseURL; + bool m_absolutePath; + + QComboBox *combo; + QPushButton *button; + +}; + +#endif diff --git a/quanta/dialogs/fourbuttonmessagebox.ui b/quanta/dialogs/fourbuttonmessagebox.ui new file mode 100644 index 00000000..fba27fc4 --- /dev/null +++ b/quanta/dialogs/fourbuttonmessagebox.ui @@ -0,0 +1,164 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>FourButtonMessageBox</class> +<comment>/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; version 2 of the License. * + * * + ***************************************************************************/ +</comment> +<author>(C) 2003 Andras Mantia <amantia@kde.org></author> +<widget class="QDialog"> + <property name="name"> + <cstring>FourButtonMessageBox</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>425</width> + <height>150</height> + </rect> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>150</height> + </size> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>pixmapLabel</cstring> + </property> + <property name="maximumSize"> + <size> + <width>32</width> + <height>32</height> + </size> + </property> + </widget> + <widget class="QLabel" row="0" column="1"> + <property name="name"> + <cstring>textLabel</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="QLayoutWidget" row="2" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>layout2</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KPushButton"> + <property name="name"> + <cstring>user1Button</cstring> + </property> + <property name="text"> + <string>&Save</string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>user2Button</cstring> + </property> + <property name="text"> + <string>Save &As...</string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>user3Button</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>&Do Not Save</string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>cancelButton</cstring> + </property> + <property name="text"> + <string>&Cancel</string> + </property> + </widget> + </hbox> + </widget> + <spacer row="1" column="1"> + <property name="name"> + <cstring>spacer1</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Fixed</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>16</height> + </size> + </property> + </spacer> + </grid> +</widget> +<connections> + <connection> + <sender>cancelButton</sender> + <signal>clicked()</signal> + <receiver>FourButtonMessageBox</receiver> + <slot>cancelButton_clicked()</slot> + </connection> + <connection> + <sender>user1Button</sender> + <signal>clicked()</signal> + <receiver>FourButtonMessageBox</receiver> + <slot>user1Button_clicked()</slot> + </connection> + <connection> + <sender>user2Button</sender> + <signal>clicked()</signal> + <receiver>FourButtonMessageBox</receiver> + <slot>user2Button_clicked()</slot> + </connection> + <connection> + <sender>user3Button</sender> + <signal>clicked()</signal> + <receiver>FourButtonMessageBox</receiver> + <slot>user3Button_clicked()</slot> + </connection> +</connections> +<includes> + <include location="local" impldecl="in implementation">fourbuttonmessagebox.ui.h</include> +</includes> +<variables> + <variable>int m_status;</variable> +</variables> +<slots> + <slot>cancelButton_clicked()</slot> + <slot>user1Button_clicked()</slot> + <slot>user2Button_clicked()</slot> + <slot>user3Button_clicked()</slot> +</slots> +<functions> + <function specifier="non virtual" returnType="int">status()</function> +</functions> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/quanta/dialogs/fourbuttonmessagebox.ui.h b/quanta/dialogs/fourbuttonmessagebox.ui.h new file mode 100644 index 00000000..00f31046 --- /dev/null +++ b/quanta/dialogs/fourbuttonmessagebox.ui.h @@ -0,0 +1,51 @@ + +/**************************************************************************** +** ui.h extension file, included from the uic-generated form implementation. +** +** If you wish to add, delete or rename functions or slots use +** Qt Designer which will update this file, preserving your code. Create an +** init() function in place of a constructor, and a destroy() function in +** place of a destructor. +*****************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; version 2 of the License. * + * * + ***************************************************************************/ +//(C) 2003 Andras Mantia <amantia@kde.org> + +void FourButtonMessageBox::cancelButton_clicked() +{ + m_status = -1; + reject(); +} + + +void FourButtonMessageBox::user1Button_clicked() +{ + m_status = 1; + accept(); +} + + +void FourButtonMessageBox::user2Button_clicked() +{ + m_status = 2; + accept(); +} + + +void FourButtonMessageBox::user3Button_clicked() +{ + m_status = 3; + accept(); +} + + +int FourButtonMessageBox::status() +{ + return m_status; +} diff --git a/quanta/dialogs/loadentitydlgs.ui b/quanta/dialogs/loadentitydlgs.ui new file mode 100644 index 00000000..dffdaa17 --- /dev/null +++ b/quanta/dialogs/loadentitydlgs.ui @@ -0,0 +1,72 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>LoadEntityDlgS</class> +<widget class="QWidget"> + <property name="name"> + <cstring>LoadEntityDlgS</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>452</width> + <height>116</height> + </rect> + </property> + <property name="caption"> + <string></string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="text"> + <string>Source DTD:</string> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>textLabel2</cstring> + </property> + <property name="text"> + <string>Target DTEP:</string> + </property> + </widget> + <widget class="KURLRequester" row="0" column="1"> + <property name="name"> + <cstring>sourceDTDRequester</cstring> + </property> + <property name="filter"> + <string>*.dtd|DTD Definitions</string> + <comment>DTD Definitions</comment> + </property> + </widget> + <widget class="KComboBox" row="1" column="1"> + <property name="name"> + <cstring>targetDTEPCombo</cstring> + </property> + </widget> + <spacer row="2" column="1"> + <property name="name"> + <cstring>spacer1</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </grid> +</widget> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/quanta/dialogs/settings/Makefile.am b/quanta/dialogs/settings/Makefile.am new file mode 100644 index 00000000..0df307eb --- /dev/null +++ b/quanta/dialogs/settings/Makefile.am @@ -0,0 +1,13 @@ +noinst_LTLIBRARIES = libsettingsdialogs.la + +libsettingsdialogs_la_SOURCES = parseroptionsui.ui parseroptions.cpp \ + previewoptionss.ui previewoptions.cpp filemaskss.ui filemasks.cpp styleoptionss.ui \ + abbreviations.ui abbreviation.cpp codetemplatedlgs.ui + +METASOURCES = AUTO + +AM_CPPFLAGS = -I$(top_srcdir)/quanta/utility \ + -I$(top_srcdir)/quanta/parsers \ + -I$(top_srcdir)/quanta/src \ + $(all_includes) + diff --git a/quanta/dialogs/settings/abbreviation.cpp b/quanta/dialogs/settings/abbreviation.cpp new file mode 100644 index 00000000..56f81c0e --- /dev/null +++ b/quanta/dialogs/settings/abbreviation.cpp @@ -0,0 +1,277 @@ +/*************************************************************************** + abbreviation.cpp - description + ------------------- + copyright : (C) 2003 by Andras Mantia <amantia@kde.org> + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; version 2 of the License. * + * * + ***************************************************************************/ + +//qt includes +#include <qdom.h> +#include <qfile.h> +#include <qfileinfo.h> +#include <qlineedit.h> +#include <qtextedit.h> +#include <qtextstream.h> +#include <qtimer.h> + +//kde includes +#include <kcombobox.h> +#include <kdebug.h> +#include <kdialogbase.h> +#include <kglobal.h> +#include <kinputdialog.h> +#include <klistbox.h> +#include <klistview.h> +#include <klocale.h> +#include <kmessagebox.h> +#include <kstandarddirs.h> + +//app includes +#include "abbreviation.h" +#include "codetemplatedlgs.h" +#include "resource.h" +#include "quantacommon.h" +#include "dtds.h" + + +AbbreviationDlg::AbbreviationDlg(QWidget *parent, const char *name): + AbbreviationDlgS(parent, name) +{ + m_oldItem = 0L; + m_currentAbbrev = 0L; + + QMapConstIterator<QString, Abbreviation> it; + for (it = qConfig.abbreviations.constBegin(); it != qConfig.abbreviations.constEnd(); ++it) + { + groupCombo->insertItem(it.key()); + } + slotGroupChanged(groupCombo->currentText()); +} + +AbbreviationDlg::~AbbreviationDlg() +{ +} + +void AbbreviationDlg::slotGroupChanged(const QString& newGroupName) +{ + //save the current template + QListViewItem *item = templatesList->currentItem(); + if (item && m_currentAbbrev) + m_currentAbbrev->abbreviations.insert(item->text(0) + " " + item->text(1), codeEdit->text()); + dtepList->clear(); + templatesList->clear(); + codeEdit->clear(); + m_oldItem = 0L; + m_currentAbbrev = &qConfig.abbreviations[newGroupName]; + QString templateStr; + QString templateName; + QMap<QString, QString>::ConstIterator it; + for ( it = m_currentAbbrev->abbreviations.constBegin(); it != m_currentAbbrev->abbreviations.constEnd(); ++it ) + { + templateStr = it.key(); + templateName = templateStr.mid(templateStr.find(' ') + 1); + templateStr = templateStr.left(templateStr.find(' ')); + new KListViewItem(templatesList, templateStr, templateName); + } + for ( QStringList::ConstIterator dtepit = m_currentAbbrev->dteps.constBegin(); dtepit != m_currentAbbrev->dteps.constEnd(); ++dtepit ) + { + dtepList->insertItem(DTDs::ref()->getDTDNickNameFromName(*dtepit)); + } + templatesList->sort(); + templatesList->setCurrentItem(templatesList->firstChild()); + templatesList->setSelected(templatesList->firstChild(), true); +} + +void AbbreviationDlg::slotNewGroup() +{ + bool ok; + QString groupName = KInputDialog::getText(i18n("New Abbreviation Group"), i18n("Group name:"), "", &ok, this); + if (ok && !groupName.isEmpty()) + { + if (qConfig.abbreviations.contains(groupName)) + { + KMessageBox::error(this, i18n("<qt>There is already an abbreviation group called <b>%1</b>. Choose an unique name for the new group.</qt>").arg(groupName), i18n("Group already exists")); + QTimer::singleShot(0, this, SLOT(slotNewGroup())); + } else + { + groupCombo->insertItem(groupName); + groupCombo->setCurrentItem(groupCombo->count()-1); + slotGroupChanged(groupName); + } + } +} + +void AbbreviationDlg::slotAddDTEP() +{ + QStringList lst = DTDs::ref()->nickNameList(false); + for (uint i = 0; i < dtepList->count(); i++) + lst.remove(dtepList->text(i)); + bool ok = false; + QStringList res = KInputDialog::getItemList( + i18n( "Add DTEP" ), + i18n( "Select a DTEP:" ), lst, 0, true, &ok, this ); + if (ok) + { + dtepList->insertStringList(res); + for (QStringList::ConstIterator it = res.constBegin(); it != res.constEnd(); ++it) + { + m_currentAbbrev->dteps.append(DTDs::ref()->getDTDNameFromNickName(*it)); + } + } +} + +void AbbreviationDlg::slotRemoveDTEP() +{ + bool hasSelected = false; + for (uint i = 0; i < dtepList->count(); i++) + { + if (dtepList->isSelected(i)) + { + m_currentAbbrev->dteps.remove(DTDs::ref()->getDTDNameFromNickName(dtepList->text(i))); + dtepList->removeItem(i); + i--; + hasSelected = true; + } + } + if (!hasSelected) + { + KMessageBox::error(this, i18n("<qt>Select a DTEP from the list before using <b>Remove</b>.</qt>"), i18n("No DTEP Selected")); + } +} + +void AbbreviationDlg::slotTemplateSelectionChanged(QListViewItem* item) +{ + if (!item) + return; + //QListViewItem *m_oldItem = templatesList->currentItem(); + if (m_oldItem) + { + QString key = m_oldItem->text(0)+" " +m_oldItem->text(1); + m_currentAbbrev->abbreviations.insert(key, codeEdit->text()); + } + + QString code = m_currentAbbrev->abbreviations[item->text(0)+" " +item->text(1)]; + codeEdit->setText(code); + m_oldItem = item; +} + +void AbbreviationDlg::slotAddTemplate() +{ + KDialogBase dlg(this, 0, true, i18n("Add Code Template"), KDialogBase::Ok | KDialogBase::Cancel); + CodeTemplateDlgS w(&dlg); + dlg.setMainWidget(&w); + w.templateEdit->setFocus(); + if (dlg.exec()) + { + QString templateName = w.templateEdit->text(); + QString description = w.descriptionEdit->text(); + if (!templateName.isEmpty()) + { + QListViewItem *item = new KListViewItem(templatesList, templateName, description); + templatesList->setCurrentItem(item); + templatesList->setSelected(item, true); + templatesList->ensureItemVisible(item); + codeEdit->setFocus(); + } + } +} + +void AbbreviationDlg::slotRemoveTemplate() +{ + QListViewItem *item = templatesList->currentItem(); + if (item && + KMessageBox::warningContinueCancel(this, i18n("<qt>Do you really want to remove the <b>%1</b> template?</qt>").arg(item->text(1)),QString::null,KStdGuiItem::del()) == KMessageBox::Continue) + { + m_currentAbbrev->abbreviations.remove(item->text(0)+" "+item->text(1)); + delete item; + m_oldItem = 0L; + slotTemplateSelectionChanged(templatesList->currentItem()); + } +} + +void AbbreviationDlg::slotEditTemplate() +{ + QListViewItem *item = templatesList->currentItem(); + if (!item) + return; + KDialogBase dlg(this, 0, true, i18n("Edit Code Template"), KDialogBase::Ok | KDialogBase::Cancel); + CodeTemplateDlgS w(&dlg); + dlg.setMainWidget(&w); + w.templateEdit->setText(item->text(0)); + w.descriptionEdit->setText(item->text(1)); + if (dlg.exec()) + { + m_currentAbbrev->abbreviations.remove(item->text(0)+" "+item->text(1)); + item->setText(0, w.templateEdit->text()); + item->setText(1, w.descriptionEdit->text()); + m_currentAbbrev->abbreviations.insert(item->text(0) + " " + item->text(1), codeEdit->text()); + } +} + + +void AbbreviationDlg::saveTemplates() +{ + QListViewItem *item = templatesList->currentItem(); + if (item && m_currentAbbrev) + m_currentAbbrev->abbreviations.insert(item->text(0) + " " + item->text(1), codeEdit->text()); + QString abbrevFile = KGlobal::dirs()->saveLocation("data") + resourceDir + "abbreviations.xml"; + QString s = "<!DOCTYPE Templates>\n<Templates>\n</Templates>\n"; + QString s2; + QDomDocument doc; + doc.setContent(s); + QDomNode firstNode = doc.firstChild(); + Abbreviation abbrev; + QMap<QString, Abbreviation>::ConstIterator abbrevIt; + for (abbrevIt = qConfig.abbreviations.constBegin(); abbrevIt != qConfig.abbreviations.constEnd(); ++abbrevIt) + { + QDomElement groupEl = doc.createElement("Group"); + groupEl.setAttribute("name", abbrevIt.key()); + abbrev = abbrevIt.data(); + for (QStringList::ConstIterator dtepIt = abbrev.dteps.constBegin(); dtepIt != abbrev.dteps.constEnd(); ++dtepIt) + { + QDomElement el = doc.createElement("DTEP"); + el.setAttribute("name", *dtepIt); + groupEl.appendChild(el); + } + int pos; + QMap<QString,QString>::ConstIterator it; + for (it = abbrev.abbreviations.constBegin(); it != abbrev.abbreviations.constEnd(); ++it) + { + QDomElement el = doc.createElement("Template"); + el.setAttribute("code", it.data()); + s = it.key(); + s2 = ""; + pos = s.find(' '); + if (pos != -1) + { + s2 = s.mid(pos+1); + s = s.left(pos); + } + el.setAttribute("name", s); + el.setAttribute("description", s2); + groupEl.appendChild(el); + } + firstNode.appendChild(groupEl); + } + + QFile f(abbrevFile); + if (f.open(IO_WriteOnly | IO_Truncate)) + { + QTextStream str(&f); + str.setEncoding(QTextStream::UnicodeUTF8); + str << doc.toString(); + f.close(); + } else + { + KMessageBox::error(this, i18n("<qt>Cannot open the file <b>%1</b> for writing.\nModified abbreviations will be lost when you quit Quanta.</qt>").arg(s)); + } +} + +#include "abbreviation.moc" diff --git a/quanta/dialogs/settings/abbreviation.h b/quanta/dialogs/settings/abbreviation.h new file mode 100644 index 00000000..0e2a34c6 --- /dev/null +++ b/quanta/dialogs/settings/abbreviation.h @@ -0,0 +1,53 @@ +/*************************************************************************** + abbreviation.cpp - description + ------------------- + copyright : (C) 2003 by Andras Mantia <amantia@kde.org> + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; version 2 of the License. * + * * + ***************************************************************************/ + +#ifndef ABBREVIATION_H +#define ABBREVIATION_H + +#include <qmap.h> +#include <qstringlist.h> + +#include <abbreviations.h> + +class QListViewItem; +class Abbreviation; +struct DTDStruct; + +class AbbreviationDlg : public AbbreviationDlgS +{ + Q_OBJECT +public: + AbbreviationDlg(QWidget *parent, const char *name = 0); + ~AbbreviationDlg(); + + void saveTemplates(); + +public slots: + void slotGroupChanged(const QString& newGroupName); + +private slots: + void slotNewGroup(); + void slotAddDTEP(); + void slotRemoveDTEP(); + void slotTemplateSelectionChanged(QListViewItem*); + void slotAddTemplate(); + void slotRemoveTemplate(); + void slotEditTemplate(); + +private: + QListViewItem *m_oldItem; + Abbreviation *m_currentAbbrev; +}; + +#endif diff --git a/quanta/dialogs/settings/abbreviations.ui b/quanta/dialogs/settings/abbreviations.ui new file mode 100644 index 00000000..9274fdc6 --- /dev/null +++ b/quanta/dialogs/settings/abbreviations.ui @@ -0,0 +1,354 @@ +<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> +<class>AbbreviationDlgS</class> +<comment>/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; version 2 of the License. * + * * + ***************************************************************************/ +</comment> +<author>(C) 2003 Andras Mantia <amantia@kde.org></author> +<widget class="QWidget"> + <property name="name"> + <cstring>AbbreviationDlgS</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>600</width> + <height>480</height> + </rect> + </property> + <property name="caption"> + <string>Abbreviations</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KPushButton" row="1" column="2" rowspan="1" colspan="2"> + <property name="name"> + <cstring>addDTEPButton</cstring> + </property> + <property name="text"> + <string>Add...</string> + </property> + </widget> + <widget class="KPushButton" row="2" column="2" rowspan="1" colspan="2"> + <property name="name"> + <cstring>removeDTEPButton</cstring> + </property> + <property name="text"> + <string>Remove</string> + </property> + </widget> + <widget class="KPushButton" row="0" column="2" rowspan="1" colspan="2"> + <property name="name"> + <cstring>newGroupButton</cstring> + </property> + <property name="text"> + <string>&New...</string> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel1_2</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>&Group:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>groupCombo</cstring> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>&Valid for:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>dtepList</cstring> + </property> + </widget> + <widget class="KComboBox" row="0" column="1"> + <property name="name"> + <cstring>groupCombo</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="QTextEdit" row="10" column="0" rowspan="1" colspan="4"> + <property name="name"> + <cstring>codeEdit</cstring> + </property> + <property name="textFormat"> + <enum>PlainText</enum> + </property> + </widget> + <widget class="KListView" row="5" column="0" rowspan="4" colspan="2"> + <column> + <property name="text"> + <string>Template</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>Description</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>templatesList</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="resizeMode"> + <enum>LastColumn</enum> + </property> + <property name="fullWidth"> + <bool>true</bool> + </property> + </widget> + <widget class="QPushButton" row="5" column="2" rowspan="1" colspan="2"> + <property name="name"> + <cstring>addButton</cstring> + </property> + <property name="text"> + <string>&Add...</string> + </property> + </widget> + <spacer row="8" column="3"> + <property name="name"> + <cstring>spacer4</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Preferred</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>30</height> + </size> + </property> + </spacer> + <widget class="QPushButton" row="6" column="2" rowspan="1" colspan="2"> + <property name="name"> + <cstring>removeButton</cstring> + </property> + <property name="text"> + <string>&Remove</string> + </property> + </widget> + <widget class="QPushButton" row="7" column="2" rowspan="1" colspan="2"> + <property name="name"> + <cstring>editButton</cstring> + </property> + <property name="text"> + <string>&Edit...</string> + </property> + </widget> + <widget class="QLabel" row="9" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>textLabel2</cstring> + </property> + <property name="frameShape"> + <enum>NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>Plain</enum> + </property> + <property name="text"> + <string>Expands to:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>codeEdit</cstring> + </property> + </widget> + <widget class="QLabel" row="4" column="0"> + <property name="name"> + <cstring>textLabel3</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>&Templates:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>templatesList</cstring> + </property> + </widget> + <widget class="KListBox" row="1" column="1" rowspan="3" colspan="1"> + <property name="name"> + <cstring>dtepList</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>7</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="selectionMode"> + <enum>Extended</enum> + </property> + </widget> + <spacer row="3" column="3" rowspan="2" colspan="1"> + <property name="name"> + <cstring>spacer2</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </grid> +</widget> +<customwidgets> +</customwidgets> +<connections> + <connection> + <sender>templatesList</sender> + <signal>selectionChanged(QListViewItem*)</signal> + <receiver>AbbreviationDlgS</receiver> + <slot>slotTemplateSelectionChanged(QListViewItem*)</slot> + </connection> + <connection> + <sender>addButton</sender> + <signal>clicked()</signal> + <receiver>AbbreviationDlgS</receiver> + <slot>slotAddTemplate()</slot> + </connection> + <connection> + <sender>removeButton</sender> + <signal>clicked()</signal> + <receiver>AbbreviationDlgS</receiver> + <slot>slotRemoveTemplate()</slot> + </connection> + <connection> + <sender>editButton</sender> + <signal>clicked()</signal> + <receiver>AbbreviationDlgS</receiver> + <slot>slotEditTemplate()</slot> + </connection> + <connection> + <sender>groupCombo</sender> + <signal>activated(const QString&)</signal> + <receiver>AbbreviationDlgS</receiver> + <slot>slotGroupChanged(const QString&)</slot> + </connection> + <connection> + <sender>newGroupButton</sender> + <signal>clicked()</signal> + <receiver>AbbreviationDlgS</receiver> + <slot>slotNewGroup()</slot> + </connection> + <connection> + <sender>addDTEPButton</sender> + <signal>clicked()</signal> + <receiver>AbbreviationDlgS</receiver> + <slot>slotAddDTEP()</slot> + </connection> + <connection> + <sender>removeDTEPButton</sender> + <signal>clicked()</signal> + <receiver>AbbreviationDlgS</receiver> + <slot>slotRemoveDTEP()</slot> + </connection> + <connection> + <sender>templatesList</sender> + <signal>doubleClicked(QListViewItem*)</signal> + <receiver>AbbreviationDlgS</receiver> + <slot>slotEditTemplate()</slot> + </connection> +</connections> +<tabstops> + <tabstop>templatesList</tabstop> + <tabstop>groupCombo</tabstop> + <tabstop>newGroupButton</tabstop> + <tabstop>dtepList</tabstop> + <tabstop>addDTEPButton</tabstop> + <tabstop>removeDTEPButton</tabstop> + <tabstop>addButton</tabstop> + <tabstop>removeButton</tabstop> + <tabstop>editButton</tabstop> + <tabstop>codeEdit</tabstop> +</tabstops> +<slots> + <slot>slotTemplateSelectionChanged(QListViewItem*)</slot> + <slot>dtdCombo_activated(const QString&)</slot> + <slot>slotGroupChanged(const QString&)</slot> + <slot>slotAddTemplate()</slot> + <slot>slotRemoveTemplate()</slot> + <slot>templatesList_currentChanged(QListViewItem*)</slot> + <slot>slotEditTemplate()</slot> + <slot>slotAddDTEP()</slot> + <slot>slotRemoveDTEP()</slot> + <slot>slotNewGroup()</slot> +</slots> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>klistview.h</includehint> + <includehint>klistbox.h</includehint> +</includehints> +</UI> diff --git a/quanta/dialogs/settings/codetemplatedlgs.ui b/quanta/dialogs/settings/codetemplatedlgs.ui new file mode 100644 index 00000000..5aa9254f --- /dev/null +++ b/quanta/dialogs/settings/codetemplatedlgs.ui @@ -0,0 +1,81 @@ +<!DOCTYPE UI><UI version="3.1" stdsetdef="1"> +<class>CodeTemplateDlgS</class> +<comment>/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; version 2 of the License. * + * * + ***************************************************************************/ +</comment> +<author>(C) 2003 by Andras Mantia <amantia@kde.org></author> +<widget class="QWidget"> + <property name="name"> + <cstring>CodeTemplateDlgS</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>400</width> + <height>72</height> + </rect> + </property> + <property name="minimumSize"> + <size> + <width>400</width> + <height>70</height> + </size> + </property> + <property name="caption"> + <string>Add Code Template</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="text"> + <string>&Template:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>templateEdit</cstring> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>textLabel2</cstring> + </property> + <property name="text"> + <string>&Description:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>descriptionEdit</cstring> + </property> + </widget> + <widget class="QLineEdit" row="0" column="1" rowspan="1" colspan="3"> + <property name="name"> + <cstring>templateEdit</cstring> + </property> + </widget> + <widget class="QLineEdit" row="1" column="1" rowspan="1" colspan="3"> + <property name="name"> + <cstring>descriptionEdit</cstring> + </property> + </widget> + </grid> +</widget> +<tabstops> + <tabstop>templateEdit</tabstop> + <tabstop>descriptionEdit</tabstop> +</tabstops> +<slots> + <slot>accept()</slot> + <slot>reject()</slot> + <slot>pushButton4_clicked()</slot> +</slots> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/quanta/dialogs/settings/filemasks.cpp b/quanta/dialogs/settings/filemasks.cpp new file mode 100644 index 00000000..14e824c1 --- /dev/null +++ b/quanta/dialogs/settings/filemasks.cpp @@ -0,0 +1,67 @@ +/*************************************************************************** + filesmask.cpp - description + ------------------- + begin : Fri May 19 2000 + copyright : (C) 2000 by Yacovlev Alexander & Dmitry Poplavsky <pdima@mail.univ.kiev.ua> + (C) 2002 Andras Mantia <amantia@kde.org> + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +#include "filemasks.h" +#include "filemasks.moc" +// qt includes +#include <qlineedit.h> +#include <qpushbutton.h> + +//kde includes +#include <kmimetype.h> + +FileMasks::FileMasks(QWidget *parent, const char *name) + :FileMasksS(parent,name) +{ + connect(buttonDefault, SIGNAL(clicked()), this, SLOT(setToDefault())); +} + +FileMasks::~FileMasks(){ +} +/** set masks to default */ +void FileMasks::setToDefault() +{ + KMimeType::List list = KMimeType::allMimeTypes(); + KMimeType::List::iterator it; + QString markup, script, image, text; + markup = "text/css; text/html; text/sgml; text/xml; "; + script = "text/x-perl; text/x-python; text/x-php; text/x-java; text/x-asp; "; + QString name; + for ( it = list.begin(); it != list.end(); ++it ) + { + name = (*it)->name(); + if (name.contains("text")) + { + if (!markup.contains(name) && !script.contains(name)) + text += name+"; "; + } + if (name.contains("image")) + { + image += name +"; "; + } + } + lineMarkup->setText(markup); + lineScript->setText(script); + lineImage->setText(image); + lineText->setText(text); + +/* + lineHTML->setText("*.*html *.*htm *.php* *.asp *.cfm *.css *.inc* *.*HTML *.*HTM *.PHP* *.ASP *.CFM *.CSS *.INC* "); + linePHP->setText( "*.php* *.PHP*" ); + lineImages->setText("*.gif *.jpg *.png *.jpeg *.bmp *.GIF *.JPG *.PNG *.JPEG *.BMP "); + lineText->setText( "*.txt *.TXT " ); + */ +} diff --git a/quanta/dialogs/settings/filemasks.h b/quanta/dialogs/settings/filemasks.h new file mode 100644 index 00000000..2d13c1f5 --- /dev/null +++ b/quanta/dialogs/settings/filemasks.h @@ -0,0 +1,35 @@ +/*************************************************************************** + filesmask.h - description + ------------------- + begin : Fri May 19 2000 + copyright : (C) 2000 by Yacovlev Alexander & Dmitry Poplavsky <pdima@mail.univ.kiev.ua> + (C) 2002 Andras Mantia <amantia@kde.org> + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef FILEMASKS_H +#define FILEMASKS_H + +#include "filemaskss.h" + + +class FileMasks : public FileMasksS +{ + Q_OBJECT +public: + FileMasks(QWidget *parent=0, const char *name=0); + ~FileMasks(); + +public slots: + void setToDefault(); +}; + +#endif diff --git a/quanta/dialogs/settings/filemaskss.ui b/quanta/dialogs/settings/filemaskss.ui new file mode 100644 index 00000000..f8cdb4f6 --- /dev/null +++ b/quanta/dialogs/settings/filemaskss.ui @@ -0,0 +1,336 @@ +<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> +<class>FileMasksS</class> +<comment>/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +</comment> +<widget class="QWidget"> + <property name="name"> + <cstring>FileMasksS</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>571</width> + <height>571</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>3</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QComboBox" row="1" column="1"> + <property name="name"> + <cstring>encodingCombo</cstring> + </property> + </widget> + <widget class="QComboBox" row="2" column="1"> + <property name="name"> + <cstring>defaultDTDCombo</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>New files will have the extension and highlighting according to this setting</string> + </property> + </widget> + <widget class="QGroupBox" row="0" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>GroupBox1</cstring> + </property> + <property name="frameShape"> + <enum>GroupBoxPanel</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="title"> + <string>Mimetypes</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLineEdit" row="0" column="1" rowspan="1" colspan="2"> + <property name="name"> + <cstring>lineMarkup</cstring> + </property> + <property name="alignment"> + <set>AlignLeft</set> + </property> + </widget> + <widget class="QLineEdit" row="2" column="1" rowspan="1" colspan="2"> + <property name="name"> + <cstring>lineImage</cstring> + </property> + <property name="alignment"> + <set>AlignLeft</set> + </property> + </widget> + <widget class="QPushButton" row="4" column="2"> + <property name="name"> + <cstring>buttonDefault</cstring> + </property> + <property name="text"> + <string>&Reset to Default</string> + </property> + </widget> + <widget class="QLabel" row="3" column="0"> + <property name="name"> + <cstring>TextLabel4_2</cstring> + </property> + <property name="text"> + <string>Te&xts:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>lineText</cstring> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>TextLabel1_3</cstring> + </property> + <property name="text"> + <string>&Markups:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>lineMarkup</cstring> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>TextLabel3_2</cstring> + </property> + <property name="text"> + <string>&Images:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>lineImage</cstring> + </property> + </widget> + <widget class="QLineEdit" row="3" column="1" rowspan="1" colspan="2"> + <property name="name"> + <cstring>lineText</cstring> + </property> + <property name="alignment"> + <set>AlignLeft</set> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>TextLabel2_2</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>&Scripts:</string> + </property> + <property name="scaledContents"> + <bool>false</bool> + </property> + <property name="buddy" stdset="0"> + <cstring>lineScript</cstring> + </property> + </widget> + <spacer row="4" column="1"> + <property name="name"> + <cstring>Spacer2_2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>153</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QLineEdit" row="1" column="1" rowspan="1" colspan="2"> + <property name="name"> + <cstring>lineScript</cstring> + </property> + <property name="alignment"> + <set>AlignLeft</set> + </property> + </widget> + </grid> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>TextLabel1_2</cstring> + </property> + <property name="text"> + <string>Default character &encoding:</string> + </property> + <property name="alignment"> + <set>AlignVCenter|AlignLeft</set> + </property> + <property name="buddy" stdset="0"> + <cstring>encodingCombo</cstring> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>TextLabel1_2_3</cstring> + </property> + <property name="text"> + <string>Default &DTD:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>defaultDTDCombo</cstring> + </property> + </widget> + <spacer row="6" column="0"> + <property name="name"> + <cstring>spacer3</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>50</height> + </size> + </property> + </spacer> + <widget class="QButtonGroup" row="5" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>buttonGroup7</cstring> + </property> + <property name="title"> + <string>Startup Options</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox" row="3" column="0"> + <property name="name"> + <cstring>reloadFiles</cstring> + </property> + <property name="text"> + <string>L&oad last-opened files</string> + </property> + </widget> + <widget class="QCheckBox" row="1" column="0"> + <property name="name"> + <cstring>showSplash</cstring> + </property> + <property name="text"> + <string>S&how splashscreen</string> + </property> + </widget> + <widget class="QCheckBox" row="2" column="0"> + <property name="name"> + <cstring>reloadProject</cstring> + </property> + <property name="text"> + <string>&Load last-opened project</string> + </property> + </widget> + </grid> + </widget> + <widget class="QLayoutWidget" row="4" column="0"> + <property name="name"> + <cstring>layout2</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>tlAutoSave</cstring> + </property> + <property name="text"> + <string>Create backups every</string> + </property> + </widget> + <widget class="QSpinBox"> + <property name="name"> + <cstring>sbAutoSave</cstring> + </property> + <property name="maxValue"> + <number>30000</number> + </property> + <property name="minValue"> + <number>1</number> + </property> + <property name="value"> + <number>15</number> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="text"> + <string>minutes</string> + </property> + </widget> + </hbox> + </widget> + <widget class="QCheckBox" row="3" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>showDTDSelectDialog</cstring> + </property> + <property name="text"> + <string>Show the DTD selection dialog when loading files with &unknown DTD</string> + </property> + </widget> + </grid> +</widget> +<tabstops> + <tabstop>lineMarkup</tabstop> + <tabstop>lineScript</tabstop> + <tabstop>lineImage</tabstop> + <tabstop>lineText</tabstop> + <tabstop>buttonDefault</tabstop> + <tabstop>encodingCombo</tabstop> + <tabstop>defaultDTDCombo</tabstop> + <tabstop>showDTDSelectDialog</tabstop> + <tabstop>sbAutoSave</tabstop> + <tabstop>showSplash</tabstop> + <tabstop>reloadProject</tabstop> + <tabstop>reloadFiles</tabstop> +</tabstops> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/quanta/dialogs/settings/parseroptions.cpp b/quanta/dialogs/settings/parseroptions.cpp new file mode 100644 index 00000000..0ad00d73 --- /dev/null +++ b/quanta/dialogs/settings/parseroptions.cpp @@ -0,0 +1,86 @@ +/*************************************************************************** + parseroptions.cpp - description + ------------------- + begin : Fri Aug 23 2002 + copyright : (C) 2002 by Andras Mantia <amantia@kde.org> + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; version 2 of the License. * + * * + ***************************************************************************/ + +#include "parseroptions.h" +#include "parseroptions.moc" +#include <qcombobox.h> +#include <qspinbox.h> + +#include <klocale.h> +#include <kconfig.h> + +/* + * Constructs a ParserOptions which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' + */ +ParserOptions::ParserOptions( KConfig *a_config, QWidget* parent, const char* name ) + : ParserOptionsUI( parent, name ) +{ + config = a_config; + config->setGroup("Parser options"); + + QString handleLBM = config->readEntry("LBM", i18n("Find Tag & Open Tree")); + QString handleMBM = config->readEntry("MBM", i18n("Nothing")); + QString handleRBM = config->readEntry("RBM", i18n("Popup Menu")); + QString handleDoubleClick = config->readEntry("Double click", i18n("Select Tag Area")); + + + if ( !name ) + setName( "ParserOptions" ); + + if ( handleLBM == i18n("Find Tag & Open Tree") ) + { + comboLBM->setCurrentItem(1); + } + else + { + comboLBM->setCurrentItem(0); + } + + if ( handleMBM == i18n("Find Tag & Open Tree") ) comboMBM->setCurrentItem(0); + if ( handleMBM == i18n("Find Tag") ) comboMBM->setCurrentItem(1); + if ( handleMBM == i18n("Go to End of Tag") ) comboMBM->setCurrentItem(2); + if ( handleMBM == i18n("Select Tag Area") ) comboMBM->setCurrentItem(3); + if ( handleMBM == i18n("Nothing")) comboMBM->setCurrentItem(4); + + if ( handleDoubleClick == i18n("Select Tag Area") ) + { + comboDoubleClick->setCurrentItem(0); + } + else + { + comboDoubleClick->setCurrentItem(1); + } +} + +/* + * Destroys the object and frees any allocated resources + */ +ParserOptions::~ParserOptions() +{ + // no need to delete child widgets, Qt does it all for us +} + + +void ParserOptions::updateConfig() +{ + + config->setGroup("Parser options"); + + config->writeEntry("MBM",comboMBM->currentText()); + config->writeEntry("LBM",comboLBM->currentText()); + config->writeEntry("RBM",comboRBM->currentText()); + config->writeEntry("Double click",comboDoubleClick->currentText()); +} diff --git a/quanta/dialogs/settings/parseroptions.h b/quanta/dialogs/settings/parseroptions.h new file mode 100644 index 00000000..a4bdd0f5 --- /dev/null +++ b/quanta/dialogs/settings/parseroptions.h @@ -0,0 +1,37 @@ +/*************************************************************************** + parseroptions.h - description + ------------------- + begin : Fri Aug 23 2002 + copyright : (C) 2002 by Andras Mantia <amantia@kde.org> + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; version 2 of the License. * + * * + ***************************************************************************/ + +#ifndef PARSEROPTIONS_H +#define PARSEROPTIONS_H + +#include "parseroptionsui.h" + +class KConfig; + +class ParserOptions : public ParserOptionsUI +{ + Q_OBJECT + +public: + ParserOptions( KConfig *config, QWidget* parent = 0, const char* name = 0); + ~ParserOptions(); + + void updateConfig(); + +protected: + KConfig *config; +}; + +#endif // PARSEROPTIONS_H diff --git a/quanta/dialogs/settings/parseroptionsui.ui b/quanta/dialogs/settings/parseroptionsui.ui new file mode 100644 index 00000000..34a54cd6 --- /dev/null +++ b/quanta/dialogs/settings/parseroptionsui.ui @@ -0,0 +1,314 @@ +<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> +<class>ParserOptionsUI</class> +<comment>/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; version 2 of the License. * + * * + ***************************************************************************/ +</comment> +<author>(C) 2002 Andras Mantia <amantia@kde.org></author> +<widget class="QWidget"> + <property name="name"> + <cstring>ParserOptionsUI</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>470</width> + <height>413</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QButtonGroup" row="1" column="0"> + <property name="name"> + <cstring>buttonGroup1</cstring> + </property> + <property name="title"> + <string>Structure Tree Look && Feel</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QSpinBox" row="3" column="2"> + <property name="name"> + <cstring>refreshFrequency</cstring> + </property> + <property name="minValue"> + <number>0</number> + </property> + <property name="value"> + <number>5</number> + </property> + <property name="toolTip" stdset="0"> + <string>Use 0 to disable the automatic refresh of structure tree</string> + </property> + </widget> + <spacer row="4" column="1"> + <property name="name"> + <cstring>Spacer4_2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>122</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QCheckBox" row="2" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>instantUpdate</cstring> + </property> + <property name="text"> + <string>Instant update</string> + </property> + <property name="toolTip" stdset="0"> + <string>Update the structure tree after every keystroke</string> + </property> + </widget> + <spacer row="3" column="1"> + <property name="name"> + <cstring>Spacer2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>122</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QCheckBox" row="1" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>showClosingTags</cstring> + </property> + <property name="text"> + <string>Show closing tags</string> + </property> + </widget> + <widget class="QCheckBox" row="0" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>showEmptyNodes</cstring> + </property> + <property name="text"> + <string>Show empt&y nodes and groups</string> + </property> + </widget> + <widget class="QSpinBox" row="4" column="2"> + <property name="name"> + <cstring>spinExpand</cstring> + </property> + <property name="value"> + <number>4</number> + </property> + <property name="toolTip" stdset="0"> + <string>Set to 0 in order to expand the whole tree</string> + </property> + </widget> + <widget class="QLabel" row="3" column="0"> + <property name="name"> + <cstring>TextLabel1_5</cstring> + </property> + <property name="text"> + <string>Refresh frequency (in seconds):</string> + </property> + </widget> + <widget class="QLabel" row="4" column="0"> + <property name="name"> + <cstring>TextLabel2_2</cstring> + </property> + <property name="text"> + <string>Expand tree when reparse to level:</string> + </property> + </widget> + </grid> + </widget> + <widget class="QGroupBox" row="0" column="0"> + <property name="name"> + <cstring>GroupBox1</cstring> + </property> + <property name="title"> + <string>Clicks on Structure Tree Items</string> + </property> + <property name="toolTip" stdset="0"> + <string>Update the structure tree after every keystroke</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QComboBox" row="3" column="1"> + <item> + <property name="text"> + <string>Select Tag Area</string> + </property> + </item> + <item> + <property name="text"> + <string>Nothing</string> + </property> + </item> + <property name="name"> + <cstring>comboDoubleClick</cstring> + </property> + </widget> + <widget class="QComboBox" row="0" column="1"> + <item> + <property name="text"> + <string>Find Tag</string> + </property> + </item> + <item> + <property name="text"> + <string>Find Tag & Open Tree</string> + </property> + </item> + <property name="name"> + <cstring>comboLBM</cstring> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>TextLabel1</cstring> + </property> + <property name="text"> + <string>Left button:</string> + </property> + </widget> + <widget class="QComboBox" row="2" column="1"> + <item> + <property name="text"> + <string>Popup Menu</string> + </property> + </item> + <property name="name"> + <cstring>comboRBM</cstring> + </property> + </widget> + <widget class="QLabel" row="3" column="0"> + <property name="name"> + <cstring>TextLabel1_4</cstring> + </property> + <property name="text"> + <string>Double click:</string> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>TextLabel1_2</cstring> + </property> + <property name="text"> + <string>Middle button:</string> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>TextLabel1_3</cstring> + </property> + <property name="text"> + <string>Right button:</string> + </property> + </widget> + <widget class="QComboBox" row="1" column="1"> + <item> + <property name="text"> + <string>Find Tag & Open Tree</string> + </property> + </item> + <item> + <property name="text"> + <string>Find Tag</string> + </property> + </item> + <item> + <property name="text"> + <string>Go to End of Tag</string> + </property> + </item> + <item> + <property name="text"> + <string>Select Tag Area</string> + </property> + </item> + <item> + <property name="text"> + <string>Nothing</string> + </property> + </item> + <property name="name"> + <cstring>comboMBM</cstring> + </property> + </widget> + </grid> + </widget> + <spacer row="2" column="0"> + <property name="name"> + <cstring>spacer3</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </grid> +</widget> +<connections> + <connection> + <sender>instantUpdate</sender> + <signal>toggled(bool)</signal> + <receiver>refreshFrequency</receiver> + <slot>setDisabled(bool)</slot> + </connection> +</connections> +<tabstops> + <tabstop>comboLBM</tabstop> + <tabstop>comboMBM</tabstop> + <tabstop>comboRBM</tabstop> + <tabstop>comboDoubleClick</tabstop> + <tabstop>showEmptyNodes</tabstop> + <tabstop>showClosingTags</tabstop> + <tabstop>instantUpdate</tabstop> + <tabstop>refreshFrequency</tabstop> + <tabstop>spinExpand</tabstop> +</tabstops> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/quanta/dialogs/settings/previewoptions.cpp b/quanta/dialogs/settings/previewoptions.cpp new file mode 100644 index 00000000..c445c52d --- /dev/null +++ b/quanta/dialogs/settings/previewoptions.cpp @@ -0,0 +1,127 @@ +/*************************************************************************** + previewoptions.cpp - description + ------------------- + begin : Fri Aug 4 2000 + copyright : (C) 2000 by Dmitry Poplavsky & Alexander Yakovlev & Eric Laffoon <pdima@users.sourceforge.net,yshurik@penguinpowered.com,sequitur@easystreet.com> + (C) 2002, 2004 Andras Mantia <amantia@kde.org> + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +#include "previewoptions.h" +#include "previewoptions.moc" +// qt includes +#include <qradiobutton.h> +#include <qcheckbox.h> +// kde includes +#include <klocale.h> +#include <kmessagebox.h> + +PreviewOptions::PreviewOptions(QWidget *parent, const char *name) + : PreviewOptionsS(parent,name) +{ +} + +PreviewOptions::~PreviewOptions(){ +} + +void PreviewOptions::setWindowLayout(const QString& layout ) +{ + if ( layout == "Default") resetLayout->setChecked(true); + else resetLayout->setChecked(false); +} + +void PreviewOptions::setPosition(const QString& position ) +{ + radioEditor->setChecked(true); + if ( position == "Toolview" ) radioToolview->setChecked(true); +} + +QString PreviewOptions::position() +{ + QString position = "Editor"; + if ( radioToolview->isChecked() ) + position = "Toolview"; + return position; +} + +void PreviewOptions::setDocPosition(const QString &position) +{ + radioNewDocTab->setChecked(true); + if (position == "Toolview") radioSeparateDocView->setChecked(true); +} + +QString PreviewOptions::docPosition() +{ + QString position = "Tab"; + if (radioSeparateDocView->isChecked()) position = "Toolview"; + return position; +} + +QString PreviewOptions::layout() +{ + QString layout = "Custom"; + if ( resetLayout->isChecked() ) + layout = "Default"; + return layout; +} + +QString PreviewOptions::closeButtons() +{ + QString closeButtonState = "ShowAlways"; + if (radioDelayedCloseButtons->isChecked()) + closeButtonState = "ShowDelayed"; + if (radioNoCloseButtons->isChecked()) + closeButtonState = "Disabled"; + return closeButtonState; +} + +void PreviewOptions::setCloseButtons(const QString &state) +{ + if (state == "ShowAlways") radioShowCloseButtons->setChecked(true); + if (state == "ShowDelayed") radioDelayedCloseButtons->setChecked(true); + if (state == "Disabled") radioNoCloseButtons->setChecked(true); +} + +void PreviewOptions::setToolviewTabs(uint state) +{ + radioIcon->setChecked(true); + if (state == 3) radioIconText->setChecked(true); + if (state == 1) radioText->setChecked(true); + m_toolviewTabs = state; +} + +uint PreviewOptions::toolviewTabs() +{ + uint state = 0; + if (radioIconText->isChecked()) state = 3; + if (radioText->isChecked()) state = 1; + return state; +} + +void PreviewOptions::setHiddenFiles(bool show) +{ + showHidden->setChecked(show); +} + +bool PreviewOptions::hiddenFiles() +{ + return showHidden->isChecked(); +} + + +void PreviewOptions::setSaveTrees(bool show) +{ + saveLocalTrees->setChecked(show); +} + +bool PreviewOptions::saveTrees() +{ + return saveLocalTrees->isChecked(); +} diff --git a/quanta/dialogs/settings/previewoptions.h b/quanta/dialogs/settings/previewoptions.h new file mode 100644 index 00000000..cb1f6719 --- /dev/null +++ b/quanta/dialogs/settings/previewoptions.h @@ -0,0 +1,50 @@ +/*************************************************************************** + previewoptions.h - description + ------------------- + begin : Fri Aug 4 2000 + copyright : (C) 2000 by Dmitry Poplavsky & Alexander Yakovlev & Eric Laffoon <pdima@users.sourceforge.net,yshurik@penguinpowered.com,sequitur@easystreet.com> + (C) 2002, 2004 Andras Mantia <amantia@kde.org> + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef PREVIEWOPTIONS_H +#define PREVIEWOPTIONS_H + +#include "previewoptionss.h" + +class KConfig; + +class PreviewOptions : public PreviewOptionsS { + Q_OBJECT +public: + PreviewOptions(QWidget *parent=0, const char *name=0); + ~PreviewOptions(); + + QString position(); + QString layout(); + QString closeButtons(); + QString docPosition(); + uint toolviewTabs(); + bool hiddenFiles(); + bool saveTrees(); + void setPosition(const QString&); + void setWindowLayout(const QString&); + void setCloseButtons(const QString&); + void setToolviewTabs(uint); + void setDocPosition(const QString&); + void setHiddenFiles(bool show); + void setSaveTrees(bool show); + +private: + uint m_toolviewTabs; +}; + +#endif diff --git a/quanta/dialogs/settings/previewoptionss.ui b/quanta/dialogs/settings/previewoptionss.ui new file mode 100644 index 00000000..a27a164b --- /dev/null +++ b/quanta/dialogs/settings/previewoptionss.ui @@ -0,0 +1,280 @@ +<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> +<class>PreviewOptionsS</class> +<comment>/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +</comment> +<widget class="QWidget"> + <property name="name"> + <cstring>PreviewOptionsS</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>498</width> + <height>512</height> + </rect> + </property> + <property name="minimumSize"> + <size> + <width>350</width> + <height>220</height> + </size> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox" row="2" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>resetLayout</cstring> + </property> + <property name="text"> + <string>Reset window layout to the default on the next startup</string> + </property> + </widget> + <widget class="QCheckBox" row="3" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>showHidden</cstring> + </property> + <property name="text"> + <string>Show hidden files in files tree</string> + </property> + </widget> + <widget class="QCheckBox" row="4" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>saveLocalTrees</cstring> + </property> + <property name="text"> + <string>Save tree status for local trees</string> + </property> + </widget> + <widget class="QButtonGroup" row="1" column="0"> + <property name="name"> + <cstring>buttonGroup3</cstring> + </property> + <property name="title"> + <string>Close Buttons on Tabs</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QRadioButton" row="1" column="0"> + <property name="name"> + <cstring>radioShowCloseButtons</cstring> + </property> + <property name="text"> + <string>&Always show</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="QRadioButton" row="0" column="0"> + <property name="name"> + <cstring>radioNoCloseButtons</cstring> + </property> + <property name="text"> + <string>&Do not show</string> + </property> + </widget> + <widget class="QRadioButton" row="2" column="0"> + <property name="name"> + <cstring>radioDelayedCloseButtons</cstring> + </property> + <property name="text"> + <string>Show dela&yed</string> + </property> + </widget> + </grid> + </widget> + <widget class="QButtonGroup" row="0" column="1"> + <property name="name"> + <cstring>buttonGroup3_2</cstring> + </property> + <property name="title"> + <string>Documentation</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QRadioButton" row="0" column="0"> + <property name="name"> + <cstring>radioNewDocTab</cstring> + </property> + <property name="text"> + <string>New tab</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="QRadioButton" row="1" column="0"> + <property name="name"> + <cstring>radioSeparateDocView</cstring> + </property> + <property name="text"> + <string>Separate toolview</string> + </property> + </widget> + </grid> + </widget> + <widget class="QButtonGroup" row="1" column="1"> + <property name="name"> + <cstring>buttonGroup4</cstring> + </property> + <property name="title"> + <string>Toolview Tabs</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QRadioButton" row="0" column="0"> + <property name="name"> + <cstring>radioIconText</cstring> + </property> + <property name="text"> + <string>Icon and text</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="QRadioButton" row="2" column="0"> + <property name="name"> + <cstring>radioText</cstring> + </property> + <property name="text"> + <string>Text</string> + </property> + </widget> + <widget class="QRadioButton" row="1" column="0"> + <property name="name"> + <cstring>radioIcon</cstring> + </property> + <property name="text"> + <string>Icon</string> + </property> + </widget> + </grid> + </widget> + <widget class="QButtonGroup" row="0" column="0"> + <property name="name"> + <cstring>ButtonGroup1</cstring> + </property> + <property name="title"> + <string>Preview</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QRadioButton" row="1" column="0"> + <property name="name"> + <cstring>radioToolview</cstring> + </property> + <property name="text"> + <string>Separate toolview</string> + </property> + </widget> + <widget class="QRadioButton" row="0" column="0"> + <property name="name"> + <cstring>radioEditor</cstring> + </property> + <property name="text"> + <string>Editor area</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </grid> + </widget> + <spacer row="6" column="0"> + <property name="name"> + <cstring>Spacer1</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>30</height> + </size> + </property> + </spacer> + <widget class="QButtonGroup" row="5" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>buttonGroup1</cstring> + </property> + <property name="title"> + <string>&Warning Messages</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox" row="0" column="0"> + <property name="name"> + <cstring>warnBinaryOpening</cstring> + </property> + <property name="text"> + <string>Warn about opening binar&y/unknown files</string> + </property> + </widget> + <widget class="QCheckBox" row="1" column="0"> + <property name="name"> + <cstring>warnEventActions</cstring> + </property> + <property name="text"> + <string>Warn when executing &actions associated with events</string> + </property> + </widget> + <widget class="QCheckBox" row="2" column="0"> + <property name="name"> + <cstring>warnAll</cstring> + </property> + <property name="text"> + <string>Show all warning messages</string> + </property> + </widget> + </grid> + </widget> + </grid> +</widget> +<tabstops> + <tabstop>radioEditor</tabstop> + <tabstop>radioNewDocTab</tabstop> + <tabstop>radioShowCloseButtons</tabstop> + <tabstop>radioIconText</tabstop> + <tabstop>resetLayout</tabstop> + <tabstop>showHidden</tabstop> + <tabstop>saveLocalTrees</tabstop> + <tabstop>warnBinaryOpening</tabstop> + <tabstop>warnEventActions</tabstop> + <tabstop>warnAll</tabstop> + <tabstop>radioToolview</tabstop> + <tabstop>radioNoCloseButtons</tabstop> + <tabstop>radioDelayedCloseButtons</tabstop> +</tabstops> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/quanta/dialogs/settings/styleoptionss.ui b/quanta/dialogs/settings/styleoptionss.ui new file mode 100644 index 00000000..13ed198d --- /dev/null +++ b/quanta/dialogs/settings/styleoptionss.ui @@ -0,0 +1,201 @@ +<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> +<class>StyleOptionsS</class> +<comment>/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +</comment> +<widget class="QWidget"> + <property name="name"> + <cstring>StyleOptionsS</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>410</width> + <height>300</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>3</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>410</width> + <height>250</height> + </size> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>TextLabel3</cstring> + </property> + <property name="text"> + <string>Attribute quotation:</string> + </property> + </widget> + <widget class="QComboBox" row="2" column="1"> + <item> + <property name="text"> + <string>Double Quotes</string> + </property> + </item> + <item> + <property name="text"> + <string>Single Quotes</string> + </property> + </item> + <property name="name"> + <cstring>attributeQuotation</cstring> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>TextLabel1</cstring> + </property> + <property name="text"> + <string>Tag case:</string> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>TextLabel2</cstring> + </property> + <property name="text"> + <string>Attribute case:</string> + </property> + </widget> + <widget class="QComboBox" row="1" column="1"> + <item> + <property name="text"> + <string>Default Case</string> + </property> + </item> + <item> + <property name="text"> + <string>Lower Case</string> + </property> + </item> + <item> + <property name="text"> + <string>Upper Case</string> + </property> + </item> + <property name="name"> + <cstring>attributeCase</cstring> + </property> + </widget> + <widget class="QCheckBox" row="3" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>optionalTagAutoClose</cstring> + </property> + <property name="text"> + <string>Auto-close o&ptional tags</string> + </property> + </widget> + <widget class="QComboBox" row="0" column="1"> + <item> + <property name="text"> + <string>Default Case</string> + </property> + </item> + <item> + <property name="text"> + <string>Lower Case</string> + </property> + </item> + <item> + <property name="text"> + <string>Upper Case</string> + </property> + </item> + <property name="name"> + <cstring>tagCase</cstring> + </property> + </widget> + <widget class="QCheckBox" row="4" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>tagAutoClose</cstring> + </property> + <property name="text"> + <string>Auto-close &non single and non optional tags</string> + </property> + </widget> + <spacer row="8" column="0"> + <property name="name"> + <cstring>spacer1</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>30</height> + </size> + </property> + </spacer> + <widget class="QCheckBox" row="6" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>tagUpdateClosing</cstring> + </property> + <property name="text"> + <string>&Update opening/closing tag automatically</string> + </property> + </widget> + <widget class="QCheckBox" row="5" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>useAutoCompletion</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Use &auto-completion</string> + </property> + </widget> + <widget class="QCheckBox" row="7" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>replaceAccented</cstring> + </property> + <property name="text"> + <string>Automatic &replacement of the accented characters</string> + </property> + <property name="whatsThis" stdset="0"> + <string>If this option is turned on the accented characters, like <b>&#225;</b>, will be automatically replaced by their unicode style notation, for the above case with <b>&#038;#225;</b>.<br> +We suggest to leave this option off and use an unicode or locale encoding for your documents.</string> + </property> + </widget> + </grid> +</widget> +<tabstops> + <tabstop>tagCase</tabstop> + <tabstop>attributeCase</tabstop> + <tabstop>attributeQuotation</tabstop> + <tabstop>optionalTagAutoClose</tabstop> + <tabstop>tagAutoClose</tabstop> + <tabstop>useAutoCompletion</tabstop> +</tabstops> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/quanta/dialogs/specialchardialog.cpp b/quanta/dialogs/specialchardialog.cpp new file mode 100644 index 00000000..e8f662ea --- /dev/null +++ b/quanta/dialogs/specialchardialog.cpp @@ -0,0 +1,88 @@ +/*************************************************************************** + specialchardialog.cpp + ------------------- + + copyright : (C) 2004 - Michal Rudolf + email : mrudolf@kdewebdev.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include <qfile.h> +#include <qpushbutton.h> +#include <qtextstream.h> +#include <qregexp.h> + +#include <klocale.h> +#include <kstandarddirs.h> +#include <klistbox.h> +#include <klineedit.h> + +#include "specialchardialog.h" +#include "resource.h" + +SpecialCharDialog::SpecialCharDialog( QWidget* parent, const char* name, bool modal, WFlags fl) + :SpecialCharDialogS( parent, name, modal, fl ) +{ + connect ( FilterLineEdit, SIGNAL(textChanged(const QString&)), + SLOT(filterChars(const QString&)) ); + connect ( CharsListBox, SIGNAL(doubleClicked(QListBoxItem*)), + SLOT(insertCode()) ); + connect (buttonOk, SIGNAL(clicked()), SLOT(insertCode())); + connect (buttonChar, SIGNAL(clicked()), SLOT(insertChar())); + connect (buttonCancel, SIGNAL(clicked()), SLOT(cancel())); + filterChars(""); +} + +SpecialCharDialog::~SpecialCharDialog() +{ +} + +void SpecialCharDialog::filterChars(const QString& filter) +{ + CharsListBox->clear(); + if (filter.isEmpty()) + CharsListBox->insertStringList(charList); + else { + for (QStringList::ConstIterator it = charList.begin(); it != charList.end(); ++it) + if ( (*it).contains(filter, false) ) + CharsListBox->insertItem(*it); + } + if (CharsListBox->currentItem() == -1 && CharsListBox->count()) + CharsListBox->setCurrentItem(0); +} + +QString SpecialCharDialog::selection() +{ + return m_selection; +} + +void SpecialCharDialog::insertCode() +{ + QString selected = CharsListBox->text(CharsListBox->currentItem()); + int begin = selected.find("(&")+1; + int length = selected.find(";)") - begin + 1; + m_selection = selected.mid(begin, length); + done(QDialog::Accepted); +} + +void SpecialCharDialog::insertChar() +{ + m_selection = CharsListBox->text(CharsListBox->currentItem()).left(1); + done(QDialog::Accepted); +} + +void SpecialCharDialog::cancel() +{ + m_selection = ""; + done(QDialog::Rejected); +} + +#include "specialchardialog.moc" diff --git a/quanta/dialogs/specialchardialog.h b/quanta/dialogs/specialchardialog.h new file mode 100644 index 00000000..23e5dc8d --- /dev/null +++ b/quanta/dialogs/specialchardialog.h @@ -0,0 +1,46 @@ +/*************************************************************************** + specialchardialog.h + ------------------- + + copyright : (C) 2004 - Michal Rudolf + email : mrudolf@kdewebdev.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef SPECIALCHARDIALOG_H +#define SPECIALCHARDIALOG_H + +#include <qstringlist.h> +#include "specialchardialogs.h" + +class SpecialCharDialog : public SpecialCharDialogS +{ + Q_OBJECT + +public: + + SpecialCharDialog( QWidget* parent = 0, const char* name = 0, bool modal = true, WFlags fl = 0); + ~SpecialCharDialog(); + QString selection(); + +public slots: + void filterChars(const QString&); + void insertChar(); + void insertCode(); + void cancel(); + +private slots: + +private: + QString m_selection; +}; + +#endif diff --git a/quanta/dialogs/specialchardialogs.ui b/quanta/dialogs/specialchardialogs.ui new file mode 100644 index 00000000..acc52e53 --- /dev/null +++ b/quanta/dialogs/specialchardialogs.ui @@ -0,0 +1,153 @@ +<!DOCTYPE UI><UI version="3.1" stdsetdef="1"> +<class>SpecialCharDialogS</class> +<widget class="QDialog"> + <property name="name"> + <cstring>SpecialCharDialogS</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>409</width> + <height>303</height> + </rect> + </property> + <property name="caption"> + <string>Insert Special Character</string> + </property> + <property name="sizeGripEnabled"> + <bool>true</bool> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="2" column="0"> + <property name="name"> + <cstring>layout4</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QPushButton"> + <property name="name"> + <cstring>buttonOk</cstring> + </property> + <property name="minimumSize"> + <size> + <width>100</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>&Insert Code</string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>buttonChar</cstring> + </property> + <property name="minimumSize"> + <size> + <width>100</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Insert C&har</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>112</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QPushButton"> + <property name="name"> + <cstring>buttonCancel</cstring> + </property> + <property name="minimumSize"> + <size> + <width>100</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>&Cancel</string> + </property> + <property name="accel"> + <string></string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget" row="0" column="0"> + <property name="name"> + <cstring>layout3</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="text"> + <string>&Filter:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>FilterLineEdit</cstring> + </property> + </widget> + <widget class="KLineEdit"> + <property name="name"> + <cstring>FilterLineEdit</cstring> + </property> + </widget> + </hbox> + </widget> + <widget class="KListBox" row="1" column="0"> + <property name="name"> + <cstring>CharsListBox</cstring> + </property> + </widget> + </grid> +</widget> +<customwidgets> +</customwidgets> +<tabstops> + <tabstop>FilterLineEdit</tabstop> + <tabstop>CharsListBox</tabstop> + <tabstop>buttonOk</tabstop> + <tabstop>buttonChar</tabstop> + <tabstop>buttonCancel</tabstop> +</tabstops> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>klineedit.h</includehint> + <includehint>klistbox.h</includehint> +</includehints> +</UI> diff --git a/quanta/dialogs/tagdialogs/Makefile.am b/quanta/dialogs/tagdialogs/Makefile.am new file mode 100644 index 00000000..ac7fd23f --- /dev/null +++ b/quanta/dialogs/tagdialogs/Makefile.am @@ -0,0 +1,18 @@ +noinst_LTLIBRARIES = libtagdialogs.la + +libtagdialogs_la_SOURCES = tagmisc.ui listdlg.cpp tagmaildlg.cpp \ + tagquicklistdlg.cpp tagquicklistdlgdata.cpp tagdialog.cpp tagattr.cpp pictureview.cpp \ + tagimgdlg.cpp tagxml.cpp tagwidget.cpp colorcombo.cpp tagimgdlgdata.cpp \ + tagmiscdlg.cpp tagmail.ui + +AM_CPPFLAGS = -I$(top_srcdir)/quanta/utility \ + -I$(top_srcdir)/quanta/parsers \ + -I$(top_srcdir)/quanta/dialogs \ + -I$(top_srcdir)/quanta/components/csseditor \ + -I$(top_srcdir)/quanta/src \ + -I$(top_srcdir)/quanta/parts/kafka \ + -I$(top_srcdir)/lib \ + $(KMDI_INCLUDES) $(all_includes) + +METASOURCES = AUTO + diff --git a/quanta/dialogs/tagdialogs/colorcombo.cpp b/quanta/dialogs/tagdialogs/colorcombo.cpp new file mode 100644 index 00000000..2dcb6aa2 --- /dev/null +++ b/quanta/dialogs/tagdialogs/colorcombo.cpp @@ -0,0 +1,313 @@ +/* This file is part of the KDE libraries + Copyright (C) 1997 Martin Jones (mjones@kde.org) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +//----------------------------------------------------------------------------- +// KDE color selection dialog. +// +// 1999-09-27 Espen Sand <espensa@online.no> +// KColorDialog is now subclassed from KDialogBase. I have also extended +// KColorDialog::getColor() so that in contains a parent argument. This +// improves centering capability. +// +// layout management added Oct 1997 by Mario Weilguni +// <mweilguni@sime.com> +// + + +#include <stdio.h> +#include <stdlib.h> + +#include <qdrawutil.h> +#include <qevent.h> +#include <qfile.h> +#include <qimage.h> +#include <qlabel.h> +#include <qlayout.h> +#include <klineedit.h> +#include <qvalidator.h> +#include <qpainter.h> +#include <qpushbutton.h> +#include <qtimer.h> + +#include <kcolordialog.h> +#include <kconfig.h> +#include <kglobal.h> +#include <kglobalsettings.h> +#include <kiconloader.h> +#include <klistbox.h> +#include <klocale.h> +#include <kmessagebox.h> +#include <kseparator.h> +#include <kpalette.h> +#include <kimageeffect.h> + +#include "colorcombo.h" +#include "colorcombo.moc" + +// This is repeated from the KColorDlg, but I didn't +// want to make it public BL. +// We define it out when compiling with --enable-final in which case +// we use the version defined in KColorDlg + +#define STANDARD_PAL_SIZE 17 + +ColorCombo::ColorCombo( QWidget *parent, const char *name ) + : QComboBox( parent, name ) +{ + customColor.setRgb( 255, 255, 255 ); + internalcolor.setRgb( 255, 255, 255 ); + + hascolor = false; + + createStandardPalette(); + + addColors(); + + connect( this, SIGNAL( activated(int) ), SLOT( slotActivated(int) ) ); + connect( this, SIGNAL( highlighted(int) ), SLOT( slotHighlighted(int) ) ); +} + +ColorCombo::~ColorCombo() +{ + delete []standardPalette; + delete []standardPaletteNames; +} + +/** + Sets the current color + */ +void ColorCombo::setColor( const QColor &col ) +{ + internalcolor = col; + hascolor = true; + + addColors(); +} + + +/** + Returns the currently selected color + */ +QColor ColorCombo::color() const { + return internalcolor; +} + + +bool ColorCombo::hasColor() const{ + return hascolor; +} + + +void ColorCombo::setColorName( const QString &color ) +{ + + QColor c(color); + + if ( c.isValid() && !color.isEmpty() ) { + setColor( c ); + } + else { + hascolor = false; + addColors(); + } + +} + +QString ColorCombo::colorName() +{ + if ( hascolor ) { + int i; + + for ( i = 0; i < STANDARD_PAL_SIZE; i++ ) + if ( standardPalette[i] == internalcolor ) + return standardPaletteNames[i]; + + return internalcolor.name(); + + } + else + return ""; +} + + +void ColorCombo::resizeEvent( QResizeEvent *re ) +{ + QComboBox::resizeEvent( re ); + + addColors(); +} + +void ColorCombo::slotActivated( int index ) +{ + hascolor = ( index != 0); + + if ( index == 1 ) + { + if ( KColorDialog::getColor( customColor ) == QDialog::Accepted ) + { + QRect rect( 0, 0, width(), 20 ); + QPixmap pixmap( rect.width(), rect.height() ); + QPainter painter; + QPen pen; + + if ( qGray( customColor.rgb() ) < 128 ) + pen.setColor( white ); + else + pen.setColor( black ); + + painter.begin( &pixmap ); + QBrush brush( customColor ); + painter.fillRect( rect, brush ); + painter.setPen( pen ); + painter.drawText( 2, painter.fontMetrics().height(), + i18n("Custom...") ); + painter.end(); + + changeItem( pixmap, 1 ); + pixmap.detach(); + } + + internalcolor = customColor; + } + else + if ( index > 1 ) + internalcolor = standardPalette[ index - 2 ]; + + emit activated( internalcolor ); +} + +void ColorCombo::slotHighlighted( int index ) +{ + if ( index < 2 ) + internalcolor = customColor; + else + internalcolor = standardPalette[ index - 2 ]; + + emit highlighted( internalcolor ); +} + +void ColorCombo::addColors() +{ + QRect rect( 0, 0, width(), 20 ); + QPixmap pixmap( rect.width(), rect.height() ); + QPainter painter; + QPen pen; + int i; + + clear(); + + for ( i = 0; i < STANDARD_PAL_SIZE; i++ ) + if ( standardPalette[i] == internalcolor ) break; + + if ( i == STANDARD_PAL_SIZE ) + customColor = internalcolor; + + insertItem( i18n("None") ); + + if ( qGray( customColor.rgb() ) < 128 ) + pen.setColor( white ); + else + pen.setColor( black ); + + painter.begin( &pixmap ); + QBrush brush( customColor ); + painter.fillRect( rect, brush ); + painter.setPen( pen ); + + painter.drawText( 2, painter.fontMetrics().height(), i18n("Custom...") ); + painter.end(); + + insertItem( pixmap ); + pixmap.detach(); + + bool findColor = false; + + for ( i = 0; i < STANDARD_PAL_SIZE; i++ ) + { + painter.begin( &pixmap ); + QBrush brush( standardPalette[i] ); + painter.fillRect( rect, brush ); + painter.end(); + + insertItem( pixmap ); + pixmap.detach(); + + if ( standardPalette[i] == internalcolor ) { + setCurrentItem( i + 2 ); + findColor = true; + } + } + + if ( !findColor ) + setCurrentItem(1); + + + + if ( !hascolor ) + setCurrentItem(0); + +} + +void ColorCombo::createStandardPalette() +{ + + standardPalette = new QColor [STANDARD_PAL_SIZE]; + + int i = 0; + + standardPalette[i++] = Qt::red; + standardPalette[i++] = Qt::green; + standardPalette[i++] = Qt::blue; + standardPalette[i++] = Qt::cyan; + standardPalette[i++] = Qt::magenta; + standardPalette[i++] = Qt::yellow; + standardPalette[i++] = Qt::darkRed; + standardPalette[i++] = Qt::darkGreen; + standardPalette[i++] = Qt::darkBlue; + standardPalette[i++] = Qt::darkCyan; + standardPalette[i++] = Qt::darkMagenta; + standardPalette[i++] = Qt::darkYellow; + standardPalette[i++] = Qt::white; + standardPalette[i++] = Qt::lightGray; + standardPalette[i++] = Qt::gray; + standardPalette[i++] = Qt::darkGray; + standardPalette[i++] = Qt::black; + + + standardPaletteNames = new QString [STANDARD_PAL_SIZE]; + + i = 0; + + standardPaletteNames[i++] = "red"; + standardPaletteNames[i++] = "green"; + standardPaletteNames[i++] = "blue"; + standardPaletteNames[i++] = "cyan"; + standardPaletteNames[i++] = "magenta"; + standardPaletteNames[i++] = "yellow"; + standardPaletteNames[i++] = "darkRed"; + standardPaletteNames[i++] = "darkGreen"; + standardPaletteNames[i++] = "darkBlue"; + standardPaletteNames[i++] = "darkCyan"; + standardPaletteNames[i++] = "darkMagenta"; + standardPaletteNames[i++] = "darkYellow"; + standardPaletteNames[i++] = "white"; + standardPaletteNames[i++] = "lightGray"; + standardPaletteNames[i++] = "gray"; + standardPaletteNames[i++] = "darkGray"; + standardPaletteNames[i++] = "black"; +} diff --git a/quanta/dialogs/tagdialogs/colorcombo.h b/quanta/dialogs/tagdialogs/colorcombo.h new file mode 100644 index 00000000..35eae54a --- /dev/null +++ b/quanta/dialogs/tagdialogs/colorcombo.h @@ -0,0 +1,85 @@ +/* This file is part of the KDE libraries + Copyright (C) 1997 Martin Jones (mjones@kde.org) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +//----------------------------------------------------------------------------- +// KDE color selection combo box + +// layout management added Oct 1997 by Mario Weilguni +// <mweilguni@sime.com> + + +#ifndef COLORCOMBO_H +#define COLORCOMBO_H + +#include <qcombobox.h> +#include <kdialogbase.h> +#include <qframe.h> +#include <qpixmap.h> +#include <kcolordialog.h> +#include "kselect.h" + + +/** + * Combobox for colours. + */ +class ColorCombo : public QComboBox +{ + Q_OBJECT +public: + ColorCombo( QWidget *parent = 0L, const char *name = 0L ); + ~ColorCombo(); + + void setColor( const QColor &col ); + void setColorName(const QString &color); + QString colorName(); + /** + * Retrieve the currently selected color. + **/ + QColor color() const; + + bool hasColor() const; + +public slots: + void slotActivated( int index ); + void slotHighlighted( int index ); + +signals: + void activated( const QColor &col ); + void highlighted( const QColor &col ); + +protected: + /** + * @reimplemented + */ + virtual void resizeEvent( QResizeEvent *re ); + +private: + void createStandardPalette(); + void addColors(); + QColor customColor; + QColor internalcolor; + + bool hascolor; + + QColor *standardPalette; + QString *standardPaletteNames; + + +}; + +#endif // COLORCOMBO_H diff --git a/quanta/dialogs/tagdialogs/corewidgetdlg.cpp b/quanta/dialogs/tagdialogs/corewidgetdlg.cpp new file mode 100644 index 00000000..13a488e5 --- /dev/null +++ b/quanta/dialogs/tagdialogs/corewidgetdlg.cpp @@ -0,0 +1,76 @@ +/*************************************************************************** + corewidgetdlg.cpp - description + ------------------- + begin : Thu Mar 30 2000 + copyright : (C) 2000 by Yacovlev Alexander & Dmitry Poplavsky + email : pdima@mail.univ.kiev.ua + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +#include "corewidgetdlg.h" +#include "corewidgetdlg.moc" +#include "tagwidget.h" + +#include <qdict.h> +#include <qlineedit.h> + +CoreWidgetDlg::CoreWidgetDlg(QWidget *parent, const char *name) + :CoreWidgetDlgS(parent,name), TagWidget(parent,name) +{ +} + +CoreWidgetDlg::~CoreWidgetDlg(){ +} + +void CoreWidgetDlg::readAttributes( QDict<QString> *d ) +{ + dict = d; + + updateDict("id", lineId ); + updateDict("class", lineClass ); + updateDict("style", lineStyle ); + updateDict("title", lineTitle ); + + updateDict("lang", lineLang ); + updateDict("dir", lineDir ); + +} + +void CoreWidgetDlg::writeAttributes( QDict<QString> *d ) +{ + dict = d; + QString *t; // value of attr. + + if (( t=d->find("id") )) setValue(*t, lineId); + if (( t=d->find("class") )) setValue(*t, lineClass); + if (( t=d->find("style") )) setValue(*t, lineStyle); + if (( t=d->find("title") )) setValue(*t, lineTitle); + + if (( t=d->find("lang") )) setValue(*t, lineLang); + if (( t=d->find("dir") )) setValue(*t, lineDir); +} + + + + +/** */ +void CoreWidgetDlg::disableCoreAttribs() +{ + lineId->setEnabled(false); + lineClass->setEnabled(false); + lineStyle->setEnabled(false); + lineTitle->setEnabled(false); +} +/** */ +void CoreWidgetDlg::disableI18nAttribs() +{ + lineLang->setEnabled(false); + lineDir->setEnabled(false); +} diff --git a/quanta/dialogs/tagdialogs/listdlg.cpp b/quanta/dialogs/tagdialogs/listdlg.cpp new file mode 100644 index 00000000..396143c2 --- /dev/null +++ b/quanta/dialogs/tagdialogs/listdlg.cpp @@ -0,0 +1,60 @@ +/*************************************************************************** + listdlg.cpp - description + ------------------- + begin : Mon Nov 26 2001 + copyright : (C) 2001 by Andras Mantia <amantia@kde.org> + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; version 2 of the License. * + * (at your option) any later version. * + ***************************************************************************/ + +#include "listdlg.h" + +//kde include +#include <klistbox.h> +#include <klocale.h> + +//qt includes +#include <qpushbutton.h> +#include <qstring.h> +#include <qstringlist.h> + +ListDlg::ListDlg(QStringList &entryList,QWidget* parent, const char *name ) + :KDialogBase(parent,name), listbox(new KListBox(this)) +{ + Q_CHECK_PTR(listbox); + setMainWidget(listbox); + showButtonApply(false); + enableButtonSeparator(true); + + listbox->clear(); + listbox->insertStringList(entryList); + if(entryList.count()>0) + { + listbox->setCurrentItem(0); + } + listbox->setMinimumSize(350,150); + adjustSize(); + resize(sizeHint()); + + connect(listbox,SIGNAL(doubleClicked( QListBoxItem * )), SLOT(slotOk())); +} + +ListDlg::~ListDlg(){ +} + +QString ListDlg::getEntry() +{ + return listbox->currentText(); +} + +int ListDlg::getEntryNum() +{ + return listbox->currentItem(); +} +#include "listdlg.moc" diff --git a/quanta/dialogs/tagdialogs/listdlg.h b/quanta/dialogs/tagdialogs/listdlg.h new file mode 100644 index 00000000..be1605f2 --- /dev/null +++ b/quanta/dialogs/tagdialogs/listdlg.h @@ -0,0 +1,45 @@ +/*************************************************************************** + listdlg.h - description + ------------------- + begin : Mon Nov 26 2001 + copyright : (C) 2001 by Andras Mantia <amantia@kde.org> + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; version 2 of the License. * + * (at your option) any later version. * + ***************************************************************************/ + +#ifndef LISTDLG_H +#define LISTDLG_H + +#include <kdialogbase.h> + +class QPushButton; +class QString; +class QStringList; +class KListBox; + +/**Select an item from a list. The list is given in +the constructor as a parameter. After calling +the exec() method, you can check the +selected item with the getEntry() method. + *@author Andras Mantia + */ + +class ListDlg : public KDialogBase { +Q_OBJECT +public: + ListDlg(QStringList &entryList,QWidget* parent=0, const char *name =0); + ~ListDlg(); + QString getEntry(); + int getEntryNum(); +private: // Private attributes + /** */ + KListBox * listbox; +}; + +#endif diff --git a/quanta/dialogs/tagdialogs/pictureview.cpp b/quanta/dialogs/tagdialogs/pictureview.cpp new file mode 100644 index 00000000..0082d379 --- /dev/null +++ b/quanta/dialogs/tagdialogs/pictureview.cpp @@ -0,0 +1,103 @@ +/*************************************************************************** + pictureview.cpp - description + ------------------- + begin : Mon Nov 29 1999 + copyright : (C) 1999 by Dmitry Poplavsky & Yacovlev Alexander + email : pdima@mail.univ.kiev.ua + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "pictureview.h" +#include "pictureview.moc" +#include "qpainter.h" +#include <qimage.h> + +PictureView::PictureView(QWidget *parent, char *file, const char *name ) : QFrame(parent,name) +{ + if ( file ) { + pix = new QImage(file); + picwidth = pix->width(); + picheight = pix->height(); + x_of = 0; + y_of = 0; + scale(); + } else { + pix = new QImage(); + picwidth = 0; + picheight = 0; + x_of = 0; + y_of = 0; + } + + + setFrameStyle ( Box|Sunken ); +} + +PictureView::~PictureView() +{ +} + +void PictureView::paintEvent( QPaintEvent * e ) +{ + QPainter p; + p.begin( this ); + p.drawImage( x_of, y_of, *pix ); + p.end(); + + QFrame::paintEvent(e); + +} + +void PictureView::resizeEvent ( QResizeEvent * e){ + scale(); + QFrame::resizeEvent(e); +} + +/** set image */ +void PictureView::slotSetImage(const QString& file) +{ + pix->load( file ); + picwidth = pix->width(); + picheight = pix->height(); + + scale(); + repaint(); +} + +/** try scale image */ +void PictureView::scale(){ + float width_ot,height_ot; + + width_ot = 1; + height_ot = 1; + x_of = y_of = 0; + + if ( picwidth > size().width() ) width_ot = (float)size().width()/(float)picwidth; + else x_of = (size().width()-picwidth)/2; + if ( picheight > size().height() ) height_ot = (float)size().height()/(float)picheight; + else y_of = (size().height()-picheight)/2; + + if ( width_ot < 1 || height_ot < 1) { + if ( width_ot < height_ot) { + *pix = pix->smoothScale( (int)(width_ot*picwidth), (int)(width_ot*picheight)); + y_of = ( size().height()-(int)(width_ot*picheight) )/2; + } + else { + *pix = pix->smoothScale( (int)(height_ot*picwidth), (int)(height_ot*picheight)); + x_of = ( size().width()-(int)(height_ot*picwidth) )/2; + } + + picwidth = size().width(); + picheight = size().height(); + } + + +} diff --git a/quanta/dialogs/tagdialogs/pictureview.h b/quanta/dialogs/tagdialogs/pictureview.h new file mode 100644 index 00000000..aaf9186e --- /dev/null +++ b/quanta/dialogs/tagdialogs/pictureview.h @@ -0,0 +1,59 @@ +/*************************************************************************** + pictureview.h - description + ------------------- + begin : Mon Nov 29 1999 + copyright : (C) 1999 by Dmitry Poplavsky & Yacovlev Alexander + email : pdima@mail.univ.kiev.ua + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef PICTUREVIEW_H +#define PICTUREVIEW_H + +#include <qwidget.h> +#include <qframe.h> +class QImage; + +/**Class for images preview +used by TagImgDlg + *@author Dmitry Poplavsky & Yacovlev Alexander + */ + +class PictureView : public QFrame { + Q_OBJECT +public: + PictureView(QWidget *parent=0, char *file=0, const char *name=0); + /** try scale image */ + void scale(); +public slots: // Public slots + /** set image */ + void slotSetImage(const QString& file); +protected: // Protected methods + /** */ + virtual void resizeEvent ( QResizeEvent * e); + ~PictureView(); + +protected: + virtual void paintEvent( QPaintEvent * ); + +private: // Private attributes + /** height of image */ + int picheight; + int x_of; +private: // Private attributes + /** width of image */ + int picwidth; + int y_of; + + QImage *pix; +}; + +#endif diff --git a/quanta/dialogs/tagdialogs/tagattr.cpp b/quanta/dialogs/tagdialogs/tagattr.cpp new file mode 100644 index 00000000..772da4fb --- /dev/null +++ b/quanta/dialogs/tagdialogs/tagattr.cpp @@ -0,0 +1,97 @@ +/*************************************************************************** + tagxml.cpp - description + ------------------- + begin : ����25 14:34:07 EEST 2000 + copyright : (C) 2000 by Dmitry Poplavsky & Alexander Yakovlev <pdima@users.sourceforge.net,yshurik@linuxfan.com> + (C) 2004 Andras Mantia <amantia@kde.org> + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +//kde includes +#include <dcopref.h> +#include <kapplication.h> +#include <kdebug.h> +#include <klineedit.h> + +//qt includes +#include <qdom.h> +#include <qtextstream.h> + +//app includes +#include "tagattr.h" +#include "node.h" +#include "colorcombo.h" +#include "qtag.h" +#include "quantacommon.h" + +QString Attr::attrName() const +{ + return name; +} + + +Attr_list::Attr_list( QDomElement const& el, QWidget *w, QTag *dtdTag ) + : Attr(el, w, dtdTag) +{ + combo = (QComboBox *)w; + + QString source = el.attribute("source"); + if (source == "dcop") //fill the list with a result of a DCOP call + { + QString method = el.attribute("method"); + QString interface = el.attribute("interface", "QuantaIf"); + QString arguments = el.attribute("arguments"); + arguments.replace("%tagname%", m_dtdTag->name()); + DCOPReply reply = QuantaCommon::callDCOPMethod(interface, method, arguments); + if (reply.isValid()) + { + QStringList list = reply; + combo->insertStringList(list); + } + } + + for ( QDomElement n = el.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { + if ( n.tagName() == "items" ) { + QDomElement item = n.firstChild().toElement(); + while ( !item.isNull() ) { + combo->insertItem( item.text() ); + item = item.nextSibling().toElement(); + } + } + } + + setValue(""); +} + +void Attr_list::setValue(const QString &value) +{ + + for ( int i=0; i<combo->count(); i++ ) + if ( value == combo->text(i) ) { + combo->setCurrentItem(i); + return; + } + + combo->insertItem(value); + combo->setCurrentItem( combo->count() - 1 ); + +} + + +QDomNode findChild( QDomNode &parent, const QString &name ) +{ + for ( QDomNode n = parent.firstChild(); !n.isNull(); n = n.nextSibling() ) + if ( n.nodeName() == name ) + return n; + return QDomNode(); +} + diff --git a/quanta/dialogs/tagdialogs/tagattr.h b/quanta/dialogs/tagdialogs/tagattr.h new file mode 100644 index 00000000..30b5220d --- /dev/null +++ b/quanta/dialogs/tagdialogs/tagattr.h @@ -0,0 +1,137 @@ +/*************************************************************************** + tagxml.h - description + ------------------- + begin : ����25 14:34:07 EEST 2000 + copyright : (C) 2000 by Dmitry Poplavsky & Alexander Yakovlev <pdima@users.sourceforge.net,yshurik@linuxfan.com> + (C) 2004 Andras Mantia <amantia@kde.org> + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef TAGATTR_H +#define TAGATTR_H + +//qt includes +#include <qstring.h> +#include <qcheckbox.h> +#include <qcombobox.h> +#include <qdom.h> + +//kde includes +#include <klineedit.h> +#include <kurl.h> + +//app includes +#include "colorcombo.h" +#include "filecombo.h" + +class QDomElement; +class QWidget; +class QTag; + + +QDomNode findChild( QDomNode &parent, const QString &name ); + + +class Attr +{ + public: + Attr( QDomElement const& el, QWidget *, QTag *dtdTag ) + : domEl(el), name(domEl.attribute("name","")), m_dtdTag(dtdTag) {} + //{ domEl = el; name = domEl->attribute("name",""); m_dtdTag = dtdTag;} + virtual ~Attr(){} + + virtual QString value()=0; + virtual void setValue(const QString &value)=0; + + QString attrName() const; + QDomElement const& domElement() const { return domEl; } + + protected: + QDomElement domEl; + QString name; + QTag *m_dtdTag; +}; + + +class Attr_line : public Attr +{ + protected: + QLineEdit *line; + + public: + Attr_line( QDomElement const& el, QWidget *w, QTag *dtdTag ) : Attr(el, w, dtdTag) + { line = (QLineEdit *)w; } + virtual ~Attr_line(){}; + + virtual QString value() { return line->text(); } + virtual void setValue(const QString &value) { line->setText(value); } +}; + + +class Attr_color : public Attr +{ + protected: + ColorCombo *color; + + public: + Attr_color( QDomElement const& el, QWidget *w, QTag *dtdTag ) : Attr(el, w, dtdTag) + { color = (ColorCombo *)w; } + virtual ~Attr_color(){}; + + virtual QString value() { return color->colorName(); } + virtual void setValue(const QString &value) { color->setColorName(value); } +}; + +class Attr_file : public Attr +{ + protected: + FileCombo *file; + + public: + Attr_file( QDomElement const& el, QWidget *w , QTag * dtdTag ) : Attr(el, w, dtdTag) + { file = (FileCombo *)w; } + virtual ~Attr_file(){}; + + virtual QString value() { return file->text(); } + virtual void setValue(const QString &value) { file->setText(value); } +}; + +class Attr_list : public Attr +{ + protected: + QComboBox *combo; + + public: + Attr_list( QDomElement const& el, QWidget *w, QTag *dtdTag ); + virtual ~Attr_list(){}; + + virtual QString value() { return combo->currentText(); } + virtual void setValue(const QString &value); +}; + + +class Attr_check : public Attr +{ + protected: + QCheckBox *check; + + public: + Attr_check( QDomElement const& el, QWidget *w, QTag *dtdTag ) : Attr(el, w, dtdTag) + { check = (QCheckBox *)w; } + virtual ~Attr_check(){}; + + virtual QString value() { return check->isChecked() ? "checked" : "unchecked" ; } + virtual void setValue(const QString &value) { check->setChecked( !value.isEmpty() ); } +}; + + + +#endif diff --git a/quanta/dialogs/tagdialogs/tagdialog.cpp b/quanta/dialogs/tagdialogs/tagdialog.cpp new file mode 100644 index 00000000..b0da2f8b --- /dev/null +++ b/quanta/dialogs/tagdialogs/tagdialog.cpp @@ -0,0 +1,486 @@ +/*************************************************************************** + tagdialog.cpp - description + ------------------- + begin : Sat Apr 1 2000 + copyright : (C) 2000 by Yacovlev Alexander & Dmitry Poplavsky <pdima@mail.univ.kiev.ua> + (C) 2002-2004 by Andras Mantia <amantia@kde.org> + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +// include qt headers +#include <qdir.h> +#include <qfileinfo.h> +#include <qevent.h> + +// include kde headers +#include <klocale.h> +#include <kstandarddirs.h> +#include <ktexteditor/viewcursorinterface.h> +#include <kconfig.h> +#include <kurl.h> +#include <kstdguiitem.h> +#include <kdebug.h> + +#include "tagattr.h" +#include "tagdialog.h" +#include "tagwidget.h" +#include "tagimgdlg.h" +#include "tagxml.h" + +#include "document.h" +#include "qextfileinfo.h" +#include "quantacommon.h" +#include "resource.h" +#include "qtag.h" +#include "kafkacommon.h" + +TagDialog::TagDialog(QTag* dtdTag, Tag *tag, KURL a_baseURL) + : QTabDialog( 0L, "tagdialog", true) +{ + init(dtdTag, a_baseURL); + + m_tag = tag; + if (m_tag) + { + for (int i = 0; i < m_tag->attrCount(); i++) + { + dict->insert(m_tag->attribute(i), new QString(m_tag->attributeValue(i))); + } + } + mainDlg = 0L; + parseTag(); + +} + +TagDialog::TagDialog(QTag* dtdTag, Tag *tag, const QString& selection, KURL a_baseURL) + : QTabDialog( 0L, "tagdialog", true), m_selection(selection) +{ + init(dtdTag, a_baseURL); + + m_tag = tag; + if (m_tag) + { + for (int i = 0; i < m_tag->attrCount(); i++) + { + dict->insert(m_tag->attribute(i), new QString(m_tag->attributeValue(i))); + } + } + mainDlg = 0L; + parseTag(); +} + +TagDialog::TagDialog(QTag* dtdTag, QString attrs, KURL a_baseURL) + : QTabDialog( 0L, "tagdialog", true) +{ + init(dtdTag, a_baseURL); + if ( !attrs.isNull() ) + { + parseAttributes(attrs); + } + mainDlg = 0L; + m_tag = 0L; + parseTag(); +} + +TagDialog::TagDialog(QTag* dtdTag, const QString& selection, QString attrs, KURL a_baseURL) + : QTabDialog( 0L, "tagdialog", true), m_selection(selection) +{ + init(dtdTag, a_baseURL); + if ( !attrs.isNull() ) + { + parseAttributes(attrs); + } + mainDlg = 0L; + m_tag = 0L; + parseTag(); +} + +TagDialog::~TagDialog() +{ + if (deleteTag) + { + delete dtdTag; + } + delete dict; +} + + +void TagDialog::init(QTag *a_dtdTag, KURL a_baseURL) +{ + setOkButton(KStdGuiItem::ok().text()); + setCancelButton(KStdGuiItem::cancel().text()); + + connect( this, SIGNAL(applyButtonPressed()), SLOT(slotAccept()) ); + connect( this, SIGNAL(cancelButtonPressed()), SLOT(reject()) ); + + if (!a_dtdTag) //the tag is invalid, let's create a default one + { + dtdTag = new QTag(); + dtdTag->setName(i18n("Unknown tag")); + deleteTag = true; + } else + { + dtdTag = a_dtdTag; + deleteTag = false; + } + dict = new QDict<QString>(1,false); + dict->setAutoDelete(true); + m_baseURL = a_baseURL; + + QString caption = i18n("Tag Properties: "); + caption += dtdTag->name(); + setCaption( caption); + resize(420,400); +} +/** */ +void TagDialog::parseTag() +{ + if (dtdTag->name() != i18n("Unknown tag")) //read from the extra tags + { + QDomDocument doc; + if (dtdTag->name().lower() == "img") //NOTE: HTML specific code! + { + mainDlg = new TagImgDlg(dtdTag->parentDTD, this); + ((TagImgDlg *)mainDlg)->writeAttributes( dict ); + } + //read the tag file it is available + else if (QFileInfo(dtdTag->fileName()).exists()) + { + QFile f( dtdTag->fileName() ); + f.open( IO_ReadOnly ); + if ( doc.setContent( &f ) ) + { + QString tagName = dtdTag->name(); + QDomNodeList nodeList = doc.elementsByTagName("tag"); + for ( uint i = 0; i < nodeList.count(); i++) + { + QDomNode n = nodeList.item(i); + QString nodeTagName = n.toElement().attribute("name"); + if (!dtdTag->parentDTD->caseSensitive) + nodeTagName = nodeTagName.upper(); + if (nodeTagName == tagName && n.toElement().elementsByTagName("attr").count() > 0) //read a tag + { + mainDlg = new Tagxml( n, dtdTag, m_selection, this ); + ((Tagxml *)mainDlg)->writeAttributes( dict ); + break; + } + } + } + f.close(); + } + else + { + QString docString = "<!DOCTYPE TAGS>\n<TAGS>\n"; + docString += QString("<tag name=\"%1\">\n").arg(dtdTag->name()); + docString += QuantaCommon::xmlFromAttributes(dtdTag->attributes()); + docString += "</tag>\n</TAGS>\n"; + doc.setContent(docString); + QDomNode domNode2 = doc.firstChild().firstChild(); + mainDlg = new Tagxml( domNode2, dtdTag, m_selection, this ); + } + + if ( mainDlg ) + { + addTab( mainDlg, i18n("Main") ); + } + + KConfig *dtdConfig = new KConfig(dtdTag->parentDTD->fileName); + dtdConfig->setGroup("General"); + int numOfPages = dtdConfig->readNumEntry("NumOfPages"); + extraPageList = new QPtrList<Tagxml>(); + extraPageList->setAutoDelete(true); + for (int i = 1; i <= numOfPages; i++) + { + Tagxml *extraPage = 0L; + dtdConfig->setGroup(QString("Page%1").arg(i)); + QString title = dtdConfig->readEntry("Title"); + QStringList groupList; + groupList = dtdConfig->readListEntry("Groups"); + QDomDocument extraDoc; //build an internal tag XML for the groups + bool addPage = false; + QString docString = "<!DOCTYPE TAGS>\n<TAGS>\n"; + docString += QString("<tag name=\"Page%1\">\n").arg(i); + for (uint j = 0; j < groupList.count(); j++) + { + groupList[j] = groupList[j].stripWhiteSpace(); + } + QDomDocument commonDoc; + QString commonFileName = QFileInfo(dtdTag->fileName()).dirPath() + "/common.tag"; + if (QFile(commonFileName).exists()) + { + QFile commonFile(commonFileName); + commonFile.open(IO_ReadOnly); + if (doc.setContent(&commonFile)) + { + int row = 0; + QDomNodeList nodeList = doc.elementsByTagName("tag"); + for ( uint j = 0; j < nodeList.count(); j++) + { + QDomNode node = nodeList.item(j); + QString nodeTagName = node.toElement().attribute("name"); + if (groupList.contains(nodeTagName) && dtdTag->commonGroups.contains(nodeTagName)) //add the attributes of this common tag to a new tab + { + QString s; + QTextStream str(&s, IO_ReadWrite); + QString s2; + QTextStream str2(&s2, IO_ReadWrite); + for ( QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling() ) + { + if (n.nodeName() == "attr") + { + QDomElement el = n.toElement(); + str.reset(); + str << "<attr name=\"" << el.attribute("name") << "\" type=\"" << el.attribute("type", "input"); + str << "\" source=\"" << el.attribute("source"); + str << "\" interface=\"" << el.attribute("interface"); + str << "\" method=\"" << el.attribute("method"); + str << "\" arguments=\"" << el.attribute("arguments"); + str << "\">" << endl; + str << " <text>" << el.attribute("name") << "</text>" << endl; + str << " <textlocation col=\"0\" row=\"" << row << "\" />" << endl; + str << " <location col=\"1\" row=\"" << row << "\" />" << endl; + QDomNodeList childNodes = n.childNodes(); + for ( uint k = 0; k < childNodes.count(); k++) + { + QDomNode childNode = childNodes.item(j); + childNode.save(str2, 2); + str << s2; + } + str << "</attr>" << endl; + row++; + } + + } + docString += s; + addPage = true; + } + } + commonFile.close(); + } + } + + docString += "</tag>\n</TAGS>\n"; + if (addPage) + { + extraDoc.setContent(docString); + QDomNode domNode = extraDoc.firstChild().firstChild(); + extraPage = new Tagxml( domNode, dtdTag, m_selection, this ); + extraPage->writeAttributes( dict ); + addTab( extraPage, i18n(title.utf8()) ); + extraPageList->append(extraPage); + } +// delete attrs; + } + } +} + +/** Insert an attribute to dict*/ +void TagDialog::insertAttribute(QString *attr, QString *value) +{ + dict->insert( *attr , value ); +} + +/** Return the attributes in QDict<QString> format*/ +QDict<QString> * TagDialog::getAttributes() +{ + return dict; +} + + +/** Return all the attributes in one string*/ +QString TagDialog::getAttributeString() +{ + QDictIterator<QString> it( *dict ); + + QString attrStr; + + while ( it.current() ) { + QString attr = QuantaCommon::attrCase(it.currentKey()); + QString val = *it.current(); + + QString attrval = " "; // attr=value + + if ( val.isEmpty()) { + attrval += attr; // for checkboxes dont print ="" + } + else { + attrval += attr + "=" + qConfig.attrValueQuotation + val + qConfig.attrValueQuotation; + } + attrStr = attrval + attrStr; + + ++it; + } + return attrStr; +} + +/**Return the value of the attribute specified by attr. */ +QString TagDialog::getAttribute(const QString& attr) +{ + QString attrStr = getAttributeString()+" "; + int pos = attrStr.upper().find(attr.upper()); + if (pos != -1) + { + pos = attrStr.find("=",pos+1) + 1; + return attrStr.mid(pos, attrStr.find(" ",pos) - pos); + } + else + { + return QString::null; + } + +} + +/** */ +void TagDialog::slotAccept() +{ + + if (dtdTag->name() != i18n("Unknown tag")) + { + if ( mainDlg ) + ((Tagxml *)mainDlg)->readAttributes( dict ); + for (uint i = 0; i < extraPageList->count(); i++) + { + extraPageList->at(i)->readAttributes( dict ); + } + delete extraPageList; + } + accept(); +} + +/** return document path */ +KURL TagDialog::baseURL() +{ + return m_baseURL; +} + + +void TagDialog::parseAttributes(const QString &attrs) +{ + QString t = attrs; + + t = t.stripWhiteSpace(); + + while ( !t.isEmpty() ) + { + int i = 0; + while ( !t[i].isSpace() && !t[i].isNull() && t[i] != '=' ) i++; + + QString attr = t.left(i); + QString *value = new QString(); + + t = t.remove(0,i).stripWhiteSpace(); + + if ( t[0] == '=' ) { + t = t.remove(0,1).stripWhiteSpace(); + + if ( t[0] == '"' ) { + i = 1; + while ( t[i] != '"' && !t[i].isNull() ) i++; + if ( t[i] == '"' ) + *value = t.mid(1,i-1); + else + *value = t.mid(1,i); + t = t.remove(0,i+1).stripWhiteSpace(); + } + else + if ( t[0] == '\'' ) { + i = 1; + while ( t[i] != '\'' && !t[i].isNull() ) i++; + if ( t[i] == '\'' ) + *value = t.mid(1,i-1); + else + *value = t.mid(1,i); + t = t.remove(0,i+1).stripWhiteSpace(); + } + else { + + i=0; + while ( !t[i].isSpace() && !t[i].isNull() ) i++; + + *value = t.left(i); + t = t.remove(0,i).stripWhiteSpace(); + } + + // debug ( name+" , "+attr[attrcount]+"="+value[attrcount]+";" ); + + + + + } + // qDebug("attr :%s; value :%s;",attr.data(),value->data() ); + dict->insert( attr , value ); + } + +} + +/** Insert the new tag into the Document*/ +void TagDialog::insertTag(Document *w, bool insertInLine) +{ + if (dtdTag->name() != i18n("Unknown tag")) + { + QString newTag = getAttributeString(); + newTag = QString("<")+QuantaCommon::tagCase(dtdTag->name())+newTag; + + if ( dtdTag->parentDTD->singleTagStyle == "xml" && + (dtdTag->isSingle() || (!qConfig.closeOptionalTags && dtdTag->isOptional())) + ) + { + newTag.append(" /"); + } + newTag.append(">"); + + QString secondPartOfTag = QString("</")+QuantaCommon::tagCase(dtdTag->name())+">"; + + if ( !insertInLine ) + { + QString space=""; + space.fill( ' ',w->viewCursorIf->cursorColumnReal() ); + newTag += "\n" + space + " "; + secondPartOfTag = "\n" + space + secondPartOfTag; + } + + if ( (!qConfig.closeTags && !dtdTag->isSingle()) || + (dtdTag->isSingle()) || + (!qConfig.closeOptionalTags && dtdTag->isOptional()) ) + { + secondPartOfTag = ""; + } + + w->insertTag( newTag, secondPartOfTag); + } +} + +Node *TagDialog::buildNode(Document *w) +{ + Node *node; + QString attrStr(""); + QDictIterator<QString> it( *dict ); + + + node = kafkaCommon::createNode(dtdTag->name(), "", Tag::XmlTag, w); + + while (it.current()) + { + node->tag->editAttribute(QuantaCommon::attrCase(it.currentKey()), *it.current()); + ++it; + } + + return node; +} + +void TagDialog::showEvent(QShowEvent *ev) +{ + QTabDialog::showEvent(ev); + if (dynamic_cast<Tagxml*>(mainDlg)) + static_cast<Tagxml*>(mainDlg)->focusToFirstItem(); +} + +#include "tagdialog.moc" diff --git a/quanta/dialogs/tagdialogs/tagdialog.h b/quanta/dialogs/tagdialogs/tagdialog.h new file mode 100644 index 00000000..67809bb0 --- /dev/null +++ b/quanta/dialogs/tagdialogs/tagdialog.h @@ -0,0 +1,102 @@ +/*************************************************************************** + tagdialog.h - description + ------------------- + begin : Sat Apr 1 2000 + copyright : (C) 2000 by Yacovlev Alexander & Dmitry Poplavsky <pdima@mail.univ.kiev.ua> + (C) 2002-2003 by Andras Mantia <amantia@kde.org> + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef TAGDIALOG_H +#define TAGDIALOG_H + +#include <qwidget.h> +#include <qtabdialog.h> +#include <qdict.h> +#include <qstrlist.h> + +#include "resource.h" + +/**class for insert/edit tags + *@author Yacovlev Alexander & Dmitry Poplavsky & Andras Mantia + */ + +class Document; +class TagWidget; +class Tagxml; +class QTag; +class Tag; +class KURL; +class QShowEvent; + +class TagDialog : public QTabDialog { + Q_OBJECT + +public: + /** + constructor: edit tag if "tag" == 0L or insert new tag if tag != 0L + attr format: "attr1='value1' attr2='value2'..." + insertInLine : + true : <a></a> + false: <a> + </a> + + */ + TagDialog(QTag* dtdTag, Tag* tag, KURL a_baseURL = KURL()); + TagDialog(QTag* dtdTag, Tag* tag, const QString& selection, KURL a_baseURL = KURL()); + TagDialog(QTag* dtdTag, QString attrs=QString::null, KURL a_baseURL = KURL()); + TagDialog(QTag* dtdTag, const QString& selection, QString attrs=QString::null, KURL a_baseURL = KURL()); + ~TagDialog(); + /** Insert an attribute to dict*/ + void insertAttribute(QString *attr, QString *value); + /** */ + void parseTag(); + /** returen doc path */ + KURL baseURL(); + + + /** Return the attributes in QDict<QString> format*/ + QDict<QString> * getAttributes(); + /** Return all the attributes in one string*/ + QString getAttributeString(); + /**Return the value of the attribute specified by attr. */ + QString getAttribute(const QString& attr); + /** Insert the new tag into the Document*/ + void insertTag(Document *w, bool insertInLine = true); + /** build and return the new Node.*/ + Node *buildNode(Document *w); + +public: + + QWidget *mainDlg; + + QDict<QString> *dict; + KURL m_baseURL; + +public slots: // Public slots + void slotAccept(); + +protected slots: + virtual void showEvent(QShowEvent *ev); + +private: + bool deleteTag; + Tag *m_tag; + QTag* dtdTag; + QString m_selection; + + QPtrList<Tagxml> *extraPageList; + + void init(QTag* dtdTag, KURL a_baseURL); + void parseAttributes(const QString &attrs); +}; + +#endif diff --git a/quanta/dialogs/tagdialogs/tagimgdlg.cpp b/quanta/dialogs/tagdialogs/tagimgdlg.cpp new file mode 100644 index 00000000..efacc768 --- /dev/null +++ b/quanta/dialogs/tagdialogs/tagimgdlg.cpp @@ -0,0 +1,170 @@ +/*************************************************************************** + tagimgdlg.cpp - description + ------------------- + begin : Sat Nov 27 1999 + copyright : (C) 1999 by Yacovlev Alexander & Dmitry Poplavsky + (C) 2002, 2006 Andras Mantia + email : pdima@mail.univ.kiev.ua, amantia@kde.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +//qt includes +#include <qspinbox.h> +#include <qimage.h> +//kde includes +#include <kapplication.h> +#include <klocale.h> +#include <kio/netaccess.h> +#include <kfiledialog.h> +#include <kurl.h> + +//app includes +#include "pictureview.h" +#include "qextfileinfo.h" +#include "quantacommon.h" +#include "tagdialog.h" +#include "tagimgdlg.h" +#include "tagimgdlg.moc" + + +TagImgDlg::TagImgDlg(const DTDStruct *dtd, QWidget *parent, const char *name) + : QWidget(parent,name), TagWidget(parent,name) +{ + m_dtd = dtd; + img = 0L; + isTmpFile = false; + setCaption(name); + initDialog(); + + + connect( buttonImgSource, SIGNAL(clicked()), this, SLOT(slotFileSelect()) ); + connect( buttonRecalcImgSize, SIGNAL(clicked()), this, SLOT(slotRecalcImgSize()) ); + connect( lineImgSource, SIGNAL( returnPressed()), this, SLOT(slotLineFileSelect()) ); +} + +TagImgDlg::~TagImgDlg() +{ + if (isTmpFile) + { + KIO::NetAccess::removeTempFile(imgFileName); + isTmpFile = false; + } +} + +/** Choose new image */ +void TagImgDlg::slotImageSet(const KURL& imageURL) +{ + if (isTmpFile) + { + KIO::NetAccess::removeTempFile(imgFileName); + isTmpFile = false; + } + if (imageURL.isLocalFile()) + { + imgFileName = imageURL.path(); + } else + { + KIO::NetAccess::download(imageURL, imgFileName, this); + isTmpFile = true; + } + widgetImg->slotSetImage(imgFileName); + + img = new QImage(imgFileName); + if (!img->isNull() && lineWidth && lineHeight) + { + QString s; + s.setNum(img->width()); + lineWidth->setText(s); + s.setNum(img->height()); + lineHeight->setText(s); + } +} + +/** recalculate image size */ +void TagImgDlg::slotRecalcImgSize() +{ + if (img && lineWidth && lineHeight) { + QString s; + s.setNum( img->width() ); + lineWidth->setText( s ); + s.setNum( img->height() ); + lineHeight->setText( s ); + } +} + +/** select image */ +void TagImgDlg::slotFileSelect() +{ +//TODO: Implemented only for local files, but maybe it is enough + KURL url = KFileDialog::getOpenURL( baseURL.url(), "*.gif *.jpg *.png *.jpeg *.bmp *.GIF *.JPG *.PNG *.JPEG *.BMP"+i18n("|Image Files\n*|All Files")); + if ( !url.isEmpty() ) + { + slotImageSet( url ); + url = QExtFileInfo::toRelative(url, baseURL); + lineImgSource->setText( url.path() ); + } +} + +void TagImgDlg::slotLineFileSelect() +{ + KURL url; + QuantaCommon::setUrl(url, lineImgSource->text()); + slotImageSet(url); +} + +void TagImgDlg::readAttributes( QDict<QString> *d ) +{ + dict = d; + + updateDict("src", lineImgSource ); + updateDict("alt", lineAltText ); + if (lineWidth) + updateDict("width", lineWidth ); + if (lineHeight) + updateDict("height",lineHeight ); + if (lineHSpace) + updateDict("hspace",lineHSpace ); + if (lineVSpace) + updateDict("vspace",lineVSpace ); + if (comboAlign) + updateDict("align", comboAlign ); + if (spinBorder) + updateDict("border",spinBorder ); +} + +void TagImgDlg::writeAttributes( QDict<QString> *d ) +{ + dict = d; + QString *t; // value of attr. + + if (( t=d->find("src") )) + { + lineImgSource->setText(*t); + KURL url = baseURL; + QuantaCommon::setUrl(url, *t); + url = QExtFileInfo::toAbsolute(url, baseURL); + slotImageSet( url ); + } + if ( (t=d->find("alt")) ) + setValue(*t, lineAltText); + if ( (t=d->find("width")) && lineWidth ) + setValue(*t, lineWidth); + if ( (t=d->find("height")) && lineHeight ) + setValue(*t, lineHeight); + if ( (t=d->find("hspace")) && lineHSpace) + setValue(*t, lineHSpace); + if ( (t=d->find("vspace")) && lineVSpace ) + setValue(*t, lineVSpace); + if ( (t=d->find("align")) && comboAlign ) + setValue(*t, comboAlign); + if ( (t=d->find("border")) && spinBorder ) + setValue(*t, spinBorder); +} diff --git a/quanta/dialogs/tagdialogs/tagimgdlg.h b/quanta/dialogs/tagdialogs/tagimgdlg.h new file mode 100644 index 00000000..f1229ee2 --- /dev/null +++ b/quanta/dialogs/tagdialogs/tagimgdlg.h @@ -0,0 +1,93 @@ +/*************************************************************************** + tagimgdlg.h - description + ------------------- + begin : Sat Nov 27 1999 + copyright : (C) 1999 by Yacovlev Alexander & Dmitry Poplavsky + (C) 2002, 2006 Andras Mantia + email : pdima@mail.univ.kiev.ua, amantia@kde.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef TAGIMGDLG_H +#define TAGIMGDLG_H + +//Generated area. DO NOT EDIT!!!(begin) +#include <qwidget.h> +#include <qlabel.h> +#include <klineedit.h> +#include <qpushbutton.h> +#include <qcombobox.h> +//Generated area. DO NOT EDIT!!!(end) + +#include "tagwidget.h" +#include "qtag.h" + +class PictureView; +class QSpinBox; +class QImage; + +/** + *@author Dmitry Poplavsky & Yacovlev Alexander + */ + +class TagImgDlg : public QWidget, TagWidget { + Q_OBJECT +public: + TagImgDlg(const DTDStruct *dtd, QWidget *parent=0, const char *name=0); + ~TagImgDlg(); + +public: + void initDialog(); + //Generated area. DO NOT EDIT!!!(begin) + QLabel *labelImgSource; + KLineEdit *lineImgSource; + QPushButton *buttonImgSource; + QPushButton *buttonRecalcImgSize; + QLabel *QLabel_4; + KLineEdit *lineWidth; + QLabel *QLabel_5; + KLineEdit *lineHeight; + QLabel *QLabel_6; + KLineEdit *lineHSpace; + QLabel *QLabel_7; + KLineEdit *lineVSpace; + QLabel *QLabel_8; + KLineEdit *lineAltText; + QLabel *QLabel_9; + QSpinBox *spinBorder; + QLabel *QLabel_10; + QComboBox *comboAlign; + PictureView *widgetImg; + QPushButton *buttonOk; + QPushButton *buttonCancel; + //Generated area. DO NOT EDIT!!!(end) + +private: + QImage *img; + QString imgFileName; + bool isTmpFile; + const DTDStruct *m_dtd; + +public slots: // Public slots + /** Choose new image */ + void slotImageSet( const KURL& imageURL); + /** select image */ + void slotFileSelect(); + void slotLineFileSelect(); + + void readAttributes( QDict<QString> *d ); + void writeAttributes( QDict<QString> *d ); + /** recalculate image size */ + void slotRecalcImgSize(); +}; + +#endif + diff --git a/quanta/dialogs/tagdialogs/tagimgdlgdata.cpp b/quanta/dialogs/tagdialogs/tagimgdlgdata.cpp new file mode 100644 index 00000000..ec4a6a36 --- /dev/null +++ b/quanta/dialogs/tagdialogs/tagimgdlgdata.cpp @@ -0,0 +1,129 @@ +/********************************************************************** + --- KDevelop (KDlgEdit) generated file --- + + Last generated: Fri Apr 7 23:17:41 2000 + + DO NOT EDIT!!! This file will be automatically + regenerated by KDevelop. All changes will be lost. + + (C) 2006 Andras Mantia +**********************************************************************/ +#include <klocale.h> +#include <kurl.h> +#include <knumvalidator.h> +#include <kiconloader.h> + +#include <qlayout.h> +#include <qspinbox.h> + +#include "pictureview.h" +#include "tagimgdlg.h" + +void TagImgDlg::initDialog(){ + QGridLayout *grid = new QGridLayout( this ); + grid->setSpacing( 13 ); + grid->setMargin( 11 ); + labelImgSource= new QLabel(this,"labelImgSource"); + labelImgSource->setText(i18n("Image source:")); + grid->addMultiCellWidget(labelImgSource, 0, 0, 0, 0); + + lineImgSource= new KLineEdit(this,"lineImgSource"); + grid->addMultiCellWidget(lineImgSource, 0, 0, 1, 3); + + buttonImgSource= new QPushButton(this,"NoName"); + buttonImgSource->setText(i18n("...")); + grid->addMultiCellWidget(buttonImgSource, 0, 0, 4, 4); + + QTag *imgTag = m_dtd->tagsList->find("img"); + + if (!imgTag) + return; + + lineWidth = 0L; + if (imgTag->attribute("width")) + { + QLabel_4= new QLabel(this,"NoName"); + QLabel_4->setText(i18n("Width:")); + grid->addMultiCellWidget(QLabel_4, 1, 1, 0, 0); + + lineWidth= new KLineEdit(this,"NoName"); + lineWidth->setValidator( new KFloatValidator( lineWidth ) ); + grid->addMultiCellWidget(lineWidth, 1, 1, 1, 1); + } + + lineHeight = 0L; + if (imgTag->attribute("height")) + { + QLabel_5= new QLabel(this,"NoName"); + QLabel_5->setText(i18n("Height:")); + grid->addMultiCellWidget(QLabel_5, 1, 1, 2, 2); + + lineHeight= new KLineEdit(this,"NoName"); + lineHeight->setValidator( new KFloatValidator( lineHeight ) ); + grid->addMultiCellWidget(lineHeight, 1, 1, 3, 3); + } + + buttonRecalcImgSize= new QPushButton(this,"NoName"); + buttonRecalcImgSize->setText(i18n("...")); + grid->addMultiCellWidget(buttonRecalcImgSize, 1, 1, 4, 4); + + lineHSpace = 0L; + if (imgTag->attribute("hspace")) + { + QLabel_6= new QLabel(this,"NoName"); + QLabel_6->setText(i18n("HSpace:")); + grid->addMultiCellWidget(QLabel_6, 2, 2, 0, 0); + + lineHSpace= new KLineEdit(this,"NoName"); + grid->addMultiCellWidget(lineHSpace, 2, 2, 1, 1); + } + + lineVSpace = 0L; + if (imgTag->attribute("vspace")) + { + QLabel_7= new QLabel(this,"NoName"); + QLabel_7->setText(i18n("VSpace:")); + grid->addMultiCellWidget(QLabel_7, 2, 2, 2, 2); + + lineVSpace= new KLineEdit(this,"NoName"); + grid->addMultiCellWidget(lineVSpace, 2, 2, 3, 3); + } + + QLabel_8= new QLabel(this,"NoName"); + QLabel_8->setText(i18n("Alternate text:")); + grid->addMultiCellWidget(QLabel_8, 3, 3, 0, 0); + + lineAltText= new KLineEdit(this,"NoName"); + grid->addMultiCellWidget(lineAltText, 3, 3, 1, 4); + + spinBorder = 0L; + if (imgTag->attribute("border")) + { + QLabel_9= new QLabel(this,"NoName"); + QLabel_9->setText(i18n("Border:")); + grid->addMultiCellWidget(QLabel_9, 4, 4, 0, 0); + + spinBorder= new QSpinBox(this,"NoName"); + spinBorder->setRange(0,20); + grid->addMultiCellWidget(spinBorder, 4, 4, 1, 1); + } + + comboAlign = 0L; + if (imgTag->attribute("align")) + { + QLabel_10= new QLabel(this,"NoName"); + QLabel_10->setText(i18n("Align:")); + grid->addMultiCellWidget(QLabel_10, 4, 4, 2, 2); + + comboAlign= new QComboBox(this,"NoName"); + grid->addMultiCellWidget(comboAlign, 4, 4, 3, 4); + comboAlign->insertStringList(imgTag->attribute("align")->values); + } + + widgetImg= new PictureView(this); + grid->addMultiCellWidget(widgetImg, 5, 10, 0, 4); + + buttonImgSource->setPixmap( SmallIcon("fileopen") ); + buttonRecalcImgSize->setPixmap( SmallIcon("reload") ); + +} diff --git a/quanta/dialogs/tagdialogs/tagmail.ui b/quanta/dialogs/tagdialogs/tagmail.ui new file mode 100644 index 00000000..1ec00314 --- /dev/null +++ b/quanta/dialogs/tagdialogs/tagmail.ui @@ -0,0 +1,130 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>TagMail</class> +<widget class="QDialog"> + <property name="name"> + <cstring>TagMail</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>477</width> + <height>254</height> + </rect> + </property> + <property name="caption"> + <string></string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>AddressLabel</cstring> + </property> + <property name="text"> + <string>Email address:</string> + </property> + </widget> + <widget class="QPushButton" row="0" column="4"> + <property name="name"> + <cstring>buttonAddressSelect</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>32</width> + <height>32767</height> + </size> + </property> + <property name="text"> + <string>...</string> + </property> + </widget> + <widget class="QLineEdit" row="0" column="1" rowspan="1" colspan="3"> + <property name="name"> + <cstring>lineEmail</cstring> + </property> + </widget> + <widget class="QLineEdit" row="1" column="1" rowspan="1" colspan="3"> + <property name="name"> + <cstring>lineSubject</cstring> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>SubjectLabel</cstring> + </property> + <property name="text"> + <string>Subject:</string> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>TitleLabel</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Title:</string> + </property> + </widget> + <widget class="QTextEdit" row="2" column="1" rowspan="1" colspan="4"> + <property name="name"> + <cstring>titleEdit</cstring> + </property> + </widget> + <widget class="KPushButton" row="3" column="2"> + <property name="name"> + <cstring>buttonOk</cstring> + </property> + <property name="text"> + <string>&OK</string> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + <widget class="KPushButton" row="3" column="3" rowspan="1" colspan="2"> + <property name="name"> + <cstring>buttonCancel</cstring> + </property> + <property name="text"> + <string>&Cancel</string> + </property> + </widget> + <spacer row="3" column="1"> + <property name="name"> + <cstring>spacer2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </grid> +</widget> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/quanta/dialogs/tagdialogs/tagmaildlg.cpp b/quanta/dialogs/tagdialogs/tagmaildlg.cpp new file mode 100644 index 00000000..329ffd59 --- /dev/null +++ b/quanta/dialogs/tagdialogs/tagmaildlg.cpp @@ -0,0 +1,108 @@ +/*************************************************************************** + tagmaildlg.cpp - description + ------------------- + begin : Sat Nov 24 2001 + copyright : (C) 2001-2002 by Andras Mantia <amantia@kde.org> + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; version 2 of the License. * + * (at your option) any later version. * + ***************************************************************************/ + + +#include "tagmaildlg.h" +#include "listdlg.h" +#include "resource.h" +#include "quantacommon.h" + +//kde includes +#include <kapplication.h> +#include <kdialog.h> +#include <kiconloader.h> +#include <klocale.h> +#include <kmessagebox.h> +#include <kabc/stdaddressbook.h> + +//qt includes +#include <qlineedit.h> +#include <kpushbutton.h> +#include <qstringlist.h> +#include <qregexp.h> + + +TagMailDlg::TagMailDlg(QWidget *parent, const char *name) + :TagMail(parent, name) +{ + setCaption(name); + setModal(true); + + connect( buttonOk, SIGNAL(clicked()), SLOT(accept()) ); + connect( buttonCancel, SIGNAL(clicked()), SLOT(reject()) ); + connect( buttonAddressSelect, SIGNAL(clicked()), SLOT(slotSelectAddress()) ); + buttonOk->setIconSet(SmallIconSet("button_ok")); + buttonCancel->setIconSet(SmallIconSet("button_cancel")); + lineEmail->setFocus(); +} + +TagMailDlg::~TagMailDlg(){ +} +/** Select a mail address, using the KabApi */ +void TagMailDlg::slotSelectAddress() +{ +//Based on KMail + QString addr, email, emailString; + QStringList result; + KABC::AddressBook *addressBook = KABC::StdAddressBook::self(); + KABC::AddressBook::Iterator it; + for( it = addressBook->begin(); it != addressBook->end(); ++it ) { + QStringList emails = (*it).emails(); + QString n = (*it).prefix() + " " + + (*it).givenName() + " " + + (*it).additionalName() + " " + + (*it).familyName() + " " + + (*it).suffix(); + n = n.simplifyWhiteSpace(); + for( unsigned int i = 0; i < emails.count(); ++i ) { + if (!emails[i].isEmpty()) { + if (n.isEmpty() || (emails[i].find( "<" ) != -1)) + addr = ""; + else { /* do we really need quotes around this name ? */ + if (n.find(QRegExp("[^ 0-9A-Za-z\\x0080-\\xFFFF]")) != -1) + addr = qConfig.attrValueQuotation + n + qConfig.attrValueQuotation + " "; + else + addr = n + " "; + } + email = emails[i]; + if (!addr.isEmpty() && (email.find( "<" ) == -1) + && (email.find( ">" ) == -1) + && (email.find( "," ) == -1)) + addr += "<" + email + ">"; + else + addr += email; + addr.stripWhiteSpace(); + result.append( addr ); + } + } + } + result.sort(); + + if ( result.count() > 0 ) + { + ListDlg listDlg(result); + listDlg.setCaption(i18n("Select Address")); + if (!listDlg.exec()) return; + emailString = listDlg.getEntry(); + lineEmail->setText(emailString); + } else + { +//Actually this may mean also other erros, but the result is the same for us: cannot get the +//e-mail address + KMessageBox::error(this,i18n("No addresses found.")); + } +} + +#include "tagmaildlg.moc" diff --git a/quanta/dialogs/tagdialogs/tagmaildlg.h b/quanta/dialogs/tagdialogs/tagmaildlg.h new file mode 100644 index 00000000..590c646b --- /dev/null +++ b/quanta/dialogs/tagdialogs/tagmaildlg.h @@ -0,0 +1,35 @@ +/*************************************************************************** + tagmaildlg.h - description + ------------------- + begin : Sat Nov 24 2001 + copyright : (C) 2001 by Andras Mantia <amantia@kde.org> + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; version 2 of the License. * + * (at your option) any later version. * + ***************************************************************************/ + +#ifndef TAGMAILDLG_H +#define TAGMAILDLG_H + +#include "tagmail.h" + +/** + *@author Andras Mantia + */ + +class TagMailDlg : public TagMail { +Q_OBJECT +public: + TagMailDlg(QWidget *parent=0, const char *name=0); + ~TagMailDlg(); +private slots: // Private slots + /** Select a mail address, using the KABC */ + void slotSelectAddress(); +}; + +#endif diff --git a/quanta/dialogs/tagdialogs/tagmisc.ui b/quanta/dialogs/tagdialogs/tagmisc.ui new file mode 100644 index 00000000..39f044c9 --- /dev/null +++ b/quanta/dialogs/tagdialogs/tagmisc.ui @@ -0,0 +1,68 @@ +<!DOCTYPE UI><UI version="3.1" stdsetdef="1"> +<class>TagMisc</class> +<comment>/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; version 2 of the License. * + * (at your option) any later version. * + ***************************************************************************/ +</comment> +<author>(C) 2001, 2003 Andras Mantia <amantia@kde.org></author> +<widget class="QWidget"> + <property name="name"> + <cstring>TagMisc</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>350</width> + <height>61</height> + </rect> + </property> + <property name="minimumSize"> + <size> + <width>350</width> + <height>60</height> + </size> + </property> + <property name="caption"> + <string>Misc. Tag</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLineEdit" row="0" column="1"> + <property name="name"> + <cstring>elementName</cstring> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>TextLabel1</cstring> + </property> + <property name="text"> + <string>Element name:</string> + </property> + </widget> + <widget class="QCheckBox" row="1" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>addClosingTag</cstring> + </property> + <property name="text"> + <string>&Add closing tag</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </grid> +</widget> +<tabstops> + <tabstop>elementName</tabstop> + <tabstop>addClosingTag</tabstop> +</tabstops> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/quanta/dialogs/tagdialogs/tagmiscdlg.cpp b/quanta/dialogs/tagdialogs/tagmiscdlg.cpp new file mode 100644 index 00000000..13893a53 --- /dev/null +++ b/quanta/dialogs/tagdialogs/tagmiscdlg.cpp @@ -0,0 +1,54 @@ +/*************************************************************************** + tagmiscdlg.h - description + ------------------- + copyright : (C) 2005 Laurent Montel <montel@kde.org> + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "tagmiscdlg.h" +#include "tagmisc.h" +#include <klocale.h> +#include <qlineedit.h> +#include <qcheckbox.h> + +TagMiscDlg::TagMiscDlg( QWidget* parent, const char* name, bool addClosingTag, const QString &element ) + :KDialogBase( parent, name, true, i18n("Misc. Tag"), KDialogBase::Ok | KDialogBase::Cancel ) +{ + miscWidget = new TagMisc(this); + connect( miscWidget->elementName, SIGNAL( textChanged ( const QString & ) ), this, SLOT( slotMiscTagChanged(const QString & ) ) ); + setMainWidget(miscWidget); + miscWidget->addClosingTag->setChecked(addClosingTag); + miscWidget->elementName->setText(element); + slotMiscTagChanged( element ); +} + +TagMiscDlg::~TagMiscDlg() +{ +} + + +void TagMiscDlg::slotMiscTagChanged( const QString &_tag ) +{ + enableButtonOK( !_tag.isEmpty() ); +} + + +QString TagMiscDlg::elementTagName() const +{ + return miscWidget->elementName->text(); +} + +bool TagMiscDlg::addClosingTag() const +{ + return miscWidget->addClosingTag->isChecked(); +} + +#include "tagmiscdlg.moc" diff --git a/quanta/dialogs/tagdialogs/tagmiscdlg.h b/quanta/dialogs/tagdialogs/tagmiscdlg.h new file mode 100644 index 00000000..8e9ded91 --- /dev/null +++ b/quanta/dialogs/tagdialogs/tagmiscdlg.h @@ -0,0 +1,42 @@ +/*************************************************************************** + tagmiscdlg.h - description + ------------------- + copyright : (C) 2005 Laurent Montel <montel@kde.org> + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef TAGMISCDLG_H +#define TAGMISCDLG_H + +#include <kdialogbase.h> + + +class TagMisc; + +class TagMiscDlg : public KDialogBase +{ + Q_OBJECT + +public: + TagMiscDlg( QWidget* parent = 0, const char* name = 0, bool addClosingTag=true, const QString &element=QString::null ); + ~TagMiscDlg(); + + QString elementTagName() const; + bool addClosingTag() const; + +protected slots: + void slotMiscTagChanged( const QString & ); + +private: + TagMisc *miscWidget; +}; + +#endif // TAGMISCDLG_H diff --git a/quanta/dialogs/tagdialogs/tagquicklistdlg.cpp b/quanta/dialogs/tagdialogs/tagquicklistdlg.cpp new file mode 100644 index 00000000..ef971e83 --- /dev/null +++ b/quanta/dialogs/tagdialogs/tagquicklistdlg.cpp @@ -0,0 +1,41 @@ +/*************************************************************************** + tagquicklistdlg.cpp - description + ------------------- + begin : Sun Nov 28 1999 + copyright : (C) 1999 by Yacovlev Alexander & Dmitry Poplavsky + email : pdima@mail.univ.kiev.ua + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +#include "tagquicklistdlg.h" +#include "tagquicklistdlg.moc" +#include <qbuttongroup.h> +#include <qlabel.h> +#include <qspinbox.h> +#include <qpushbutton.h> +#include <qradiobutton.h> +#include <qgroupbox.h> + +TagQuickListDlg::TagQuickListDlg(QWidget *parent, const char *name) + : QDialog(parent,name,true) +{ + setCaption(name); + + initDialog(); + + groupBox->insert(radioOrdered); + groupBox->insert(radioUnordered); + + connect( buttonOk, SIGNAL(clicked()), SLOT(accept()) ); + connect( buttonCancel, SIGNAL(clicked()), SLOT(reject()) ); +} + +TagQuickListDlg::~TagQuickListDlg(){ +} diff --git a/quanta/dialogs/tagdialogs/tagquicklistdlg.h b/quanta/dialogs/tagdialogs/tagquicklistdlg.h new file mode 100644 index 00000000..f2426fb3 --- /dev/null +++ b/quanta/dialogs/tagdialogs/tagquicklistdlg.h @@ -0,0 +1,54 @@ +/*************************************************************************** + tagquicklistdlg.h - description + ------------------- + begin : Sun Nov 28 1999 + copyright : (C) 1999 by Yacovlev Alexander & Dmitry Poplavsky + email : pdima@mail.univ.kiev.ua + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef TAGQUICKLISTDLG_H +#define TAGQUICKLISTDLG_H + +#include <qwidget.h> + +#include <qdialog.h> +class QLabel; +class QSpinBox; +class QPushButton; +class QRadioButton; +class QButtonGroup; + +/** + *@author Dmitry Poplavsky & Yacovlev Alexander + */ + +class TagQuickListDlg : public QDialog { + Q_OBJECT +public: + TagQuickListDlg(QWidget *parent=0, const char *name=0); + ~TagQuickListDlg(); + +public: + void initDialog(); + QLabel *QLabel_1; + QSpinBox *spinBoxRows; + QPushButton *buttonOk; + QLabel *QLabel_2; + QRadioButton *radioOrdered; + QRadioButton *radioUnordered; + QPushButton *buttonCancel; + QButtonGroup *groupBox; + +private: +}; + +#endif diff --git a/quanta/dialogs/tagdialogs/tagquicklistdlgdata.cpp b/quanta/dialogs/tagdialogs/tagquicklistdlgdata.cpp new file mode 100644 index 00000000..331aefbb --- /dev/null +++ b/quanta/dialogs/tagdialogs/tagquicklistdlgdata.cpp @@ -0,0 +1,63 @@ +/********************************************************************** + --- KDevelop (KDlgEdit) generated file --- + + Last generated: Tue Dec 7 16:51:35 1999 + + DO NOT EDIT!!! This file will be automatically + regenerated by KDevelop. All changes will be lost. + +**********************************************************************/ +#include <kapplication.h> +#include <klocale.h> +#include <qbuttongroup.h> +#include "tagquicklistdlg.h" +#include <qspinbox.h> +#include <qlabel.h> +#include <kpushbutton.h> +#include <qradiobutton.h> +#include <kstdguiitem.h> + +void TagQuickListDlg::initDialog() +{ + resize(230,150); + + QLabel_1= new QLabel(this,"NoName"); + QLabel_1->setGeometry(10,10,100,30); + QLabel_1->setMinimumSize(0,0); + QLabel_1->setText(i18n("Rows:")); + + spinBoxRows= new QSpinBox(this,"NoName"); + spinBoxRows->setGeometry(120,10,100,25); + spinBoxRows->setMinimumSize(0,0); + spinBoxRows->setRange(1,99); + + buttonOk= new KPushButton(KStdGuiItem::ok(),this,"NoName"); + buttonOk->setGeometry(10,110,100,30); + buttonOk->setMinimumSize(0,0); + + QLabel_2= new QLabel(this,"NoName"); + QLabel_2->setGeometry(10,40,100,30); + QLabel_2->setMinimumSize(0,0); + QLabel_2->setText(i18n("Style:")); + + buttonCancel= new QPushButton(this,"NoName"); + buttonCancel->setGeometry(120,110,100,30); + buttonCancel->setMinimumSize(0,0); + buttonCancel->setText(KStdGuiItem::cancel().text()); + + groupBox= new QButtonGroup(this,"NoName"); + groupBox->setGeometry(120,40,100,60); + groupBox->setMinimumSize(0,0); + + radioOrdered= new QRadioButton(groupBox,"NoName"); + radioOrdered->setGeometry(5,5,90,25); + radioOrdered->setMinimumSize(0,0); + radioOrdered->setText(i18n("Ordered")); + radioOrdered->setChecked(true); + + radioUnordered= new QRadioButton(groupBox,"NoName"); + radioUnordered->setGeometry(5,30,90,25); + radioUnordered->setMinimumSize(0,0); + radioUnordered->setText(i18n("Unordered")); + radioUnordered->setChecked(false); +} diff --git a/quanta/dialogs/tagdialogs/tagwidget.cpp b/quanta/dialogs/tagdialogs/tagwidget.cpp new file mode 100644 index 00000000..0d01f7a3 --- /dev/null +++ b/quanta/dialogs/tagdialogs/tagwidget.cpp @@ -0,0 +1,119 @@ +/*************************************************************************** + tagwidget.cpp - description + ------------------- + begin : Sat Apr 1 2000 + copyright : (C) 2000 by Yacovlev Alexander & Dmitry Poplavsky <pdima@mail.univ.kiev.ua> + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +// QT files +#include <qcombobox.h> +#include <klineedit.h> +#include <qstring.h> +#include <qspinbox.h> +#include <qcheckbox.h> + +// KDE files +#include <kcolorbutton.h> +#include <kurl.h> + +// application's headers +#include "tagwidget.h" +#include "tagdialog.h" +#include "resource.h" + +TagWidget::TagWidget(QObject *parent, const char *) +{ + baseURL = ((TagDialog *)parent)->baseURL(); +} + +TagWidget::~TagWidget(){ +} + +void TagWidget::updateDict(const QString &attr, QComboBox *combo ) +{ + QString *s = new QString(combo->currentText()); + if (s->isEmpty()) + { + dict->remove(attr); + delete s; + } + else + dict->replace(attr, s); +} + +void TagWidget::setValue(const QString &val, QComboBox *combo) +{ + bool found = false; + int num = combo->count(); + + for ( int i = 0; i < num; i++) + { + if (val == combo->text(i)) + { + combo->setCurrentItem(i); + found = true; + } + } + + if (!found) + combo->setEditText(val); +} + +void TagWidget::setValue(const QString &val, QLineEdit *line) +{ + line->setText(val); +} + +void TagWidget::setValue(const QString &val, QSpinBox *spin) +{ + spin->setValue(val.toInt()); +} + +void TagWidget::setValue(const QString &val, KColorButton *button) +{ + button->setColor(val); +} + +void TagWidget::updateDict(const QString &attr, QLineEdit *line ) +{ + QString *s = new QString(line->text()); + if (s->isEmpty()) + { + dict->remove(attr); + delete s; + } + else + dict->replace(attr, s); +} + +void TagWidget::updateDict(const QString &attr, QSpinBox *spin ) +{ + QString *s = new QString(spin->text()); + if (s->isEmpty()) + { + dict->remove(attr); + delete s; + } + else + dict->replace(attr, s); +} + +void TagWidget::updateDict(const QString &attr, QCheckBox *check ) +{ + if (!check->isChecked()) + dict->remove(attr); + else + { + if (!dict->find(attr)) + dict->insert(attr, new QString("")); + } +} diff --git a/quanta/dialogs/tagdialogs/tagwidget.h b/quanta/dialogs/tagdialogs/tagwidget.h new file mode 100644 index 00000000..89f8e371 --- /dev/null +++ b/quanta/dialogs/tagdialogs/tagwidget.h @@ -0,0 +1,56 @@ +/*************************************************************************** + tagwidget.h - description + ------------------- + begin : Sat Apr 1 2000 + copyright : (C) 2000 by Yacovlev Alexander & Dmitry Poplavsky <pdima@mail.univ.kiev.ua> + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef TAGWIDGET_H +#define TAGWIDGET_H + +#include <qwidget.h> +#include <qdict.h> + +class QComboBox; +class QLineEdit; +class QSpinBox; +class QCheckBox; +class KColorButton; +class KURL; + +/**base class for tag widgets + *@author Yacovlev Alexander & Dmitry Poplavsky + */ + +class TagWidget { +public: + TagWidget(QObject *parent=0, const char *name=0); + virtual ~TagWidget(); + + virtual void readAttributes(QDict<QString> *) {}; + virtual void writeAttributes(QDict<QString> *) {}; + void updateDict(const QString &attr, QComboBox *combo); + void updateDict(const QString &attr, QLineEdit *line); + void updateDict(const QString &attr, QSpinBox *spin); + void updateDict(const QString &attr, QCheckBox *check); + + void setValue(const QString &val, QComboBox *combo); + void setValue(const QString &val, QLineEdit *line); + void setValue(const QString &val, QSpinBox *spin); + void setValue(const QString &val, KColorButton *button); + +protected: + QDict<QString> *dict; // dictionary of attributes and values + KURL baseURL; +}; + +#endif diff --git a/quanta/dialogs/tagdialogs/tagxml.cpp b/quanta/dialogs/tagdialogs/tagxml.cpp new file mode 100644 index 00000000..c9114d62 --- /dev/null +++ b/quanta/dialogs/tagdialogs/tagxml.cpp @@ -0,0 +1,343 @@ +/*************************************************************************** + tagxml.cpp - description + ------------------- + begin : � � 25 14:34:07 EEST 2000 + copyright : (C) 2000 by Dmitry Poplavsky & Alexander Yakovlev & Eric Laffoon <pdima@users.sourceforge.net,yshurik@penguinpowered.com,sequitur@easystreet.com> + (C) 2002-2004 by Andras Mantia <amantia@kde.org> + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "tagxml.h" +#include "tagattr.h" +#include <klineedit.h> +#include <kdebug.h> +#include <klocale.h> + +#include <qcheckbox.h> +#include <qlayout.h> +#include <qlabel.h> +#include <qtooltip.h> +#include <qwhatsthis.h> + +#include "styleeditor.h" + +Tagxml::Tagxml( QDomNode &d, QTag *dtdTag, QWidget *parent, const char *name) + :QWidget(parent,name), TagWidget(parent,name), doc(d) +{ + initialize(d, dtdTag); +} + +Tagxml::Tagxml( QDomNode &d, QTag *dtdTag, const QString& selection, QWidget *parent, const char *name) + : QWidget(parent,name), TagWidget(parent,name), doc(d), m_selection(selection) +{ + initialize(d, dtdTag); +} + +Tagxml::~Tagxml() +{ +} + +void Tagxml::initialize(QDomNode &d, QTag *dtdTag) +{ + m_dtd = dtdTag->parentDTD; + m_dtdTag = dtdTag; + QGridLayout *grid = new QGridLayout( this ); + grid->setSpacing( 13 ); + grid->setMargin( 11 ); + m_firstItem = 0L; +//parse the tag XML file, in order to build up the dialog + for ( QDomNode n = d.firstChild(); !n.isNull(); n = n.nextSibling() ) + { + QDomNode location = findChild(n,"location"); + if ( location.isNull() ) + continue; + + //debug( n.nodeName() ); + + QDomElement el = location.toElement(); + + int row = el.attribute("row","0").toInt(); + int col = el.attribute("col","0").toInt(); + int colspan = el.attribute("colspan","1").toInt()-1; + int rowspan = el.attribute("rowspan","1").toInt()-1; + + location = findChild(n,"textlocation"); + el = location.toElement(); + int textrow = el.attribute("row","0").toInt(); + int textcol = el.attribute("col","0").toInt(); + int textcolspan = el.attribute("colspan","1").toInt()-1; + int textrowspan = el.attribute("rowspan","1").toInt()-1; + + // qDebug("%s col:%d row:%d cs:%d, rs:%d", n.nodeName().data(), col,row,colspan,rowspan ); + + QString tip; + QDomNode tooltip = findChild( n ,"tooltip" ); + if ( !tooltip.isNull() ) { + if ( tooltip.firstChild().isText() ) { + QDomText text = tooltip.firstChild().toText(); + tip = text.data(); + } + } + QString whatsThis; + QDomNode what = findChild( n ,"whatsthis" ); + if ( !what.isNull() ) { + if ( what.firstChild().isText() ) { + QDomText text = what.firstChild().toText(); + whatsThis = text.data(); + } + } + + if ( n.nodeName() == "label" ) //a static label + { + QLabel *label = new QLabel(this); + QDomElement ltext = findChild(n,"text").toElement(); + if ( !ltext.isNull() ) + label->setText( ltext.text().isEmpty() ? QString("") : (ltext.text()+":") ); + + if ( !tip.isNull() ) + QToolTip::add( label, tip ); + if ( !whatsThis.isNull() ) + QWhatsThis::add( label, whatsThis ); + + grid->addMultiCellWidget( label, row, row+rowspan, col, col+colspan ); + } + + if ( n.nodeName() == "attr" ) //an attribute + { + + QDomElement el(n.toElement()); + QString type = el.attribute("type","input"); + + QDomElement ltext = findChild(n,"text").toElement(); + if ( !ltext.isNull() && (type != "check") ) //if there is a text label for the attribute + { + QLabel *label = new QLabel(this); + label->setText( ltext.text().isEmpty() ? QString("") : (ltext.text()+":") ); + + if ( !tip.isNull() ) + QToolTip::add( label, tip ); + if ( !whatsThis.isNull() ) + QWhatsThis::add( label, whatsThis ); + grid->addMultiCellWidget( label, textrow, textrow+textrowspan, textcol, textcol+textcolspan ); + } + + + //look for the different attribute types + if ( type == "input" ) + { + KLineEdit *w = new KLineEdit(this); + grid->addMultiCellWidget( w, row, row+rowspan, col, col+colspan ); + + if ( !tip.isNull() ) + QToolTip::add( w, tip ); + if ( !whatsThis.isNull() ) + QWhatsThis::add( w, whatsThis ); + + Attr_line *attr = new Attr_line(el, w, m_dtdTag); + attributes.append(attr); + if (!m_firstItem) + m_firstItem = w; + } + else + if ( type == "check" ) + { + QCheckBox *w = new QCheckBox(this); + grid->addMultiCellWidget( w, row, row+rowspan, col, col+colspan ); + + QDomElement ltext = findChild(n,"text").toElement(); + if ( !ltext.isNull() ) + w->setText( ltext.text() ); + if ( !tip.isNull() ) + QToolTip::add( w, tip ); + if ( !whatsThis.isNull() ) + QWhatsThis::add( w, whatsThis ); + + Attr_check *attr = new Attr_check(el, w, m_dtdTag); + attributes.append(attr); + if (!m_firstItem) + m_firstItem = w; + } else + if ( type == "list" ) + { + QComboBox *w = new QComboBox(true, this); + grid->addMultiCellWidget( w, row, row+rowspan, col, col+colspan ); + if ( !tip.isNull() ) + QToolTip::add( w, tip ); + if ( !whatsThis.isNull() ) + QWhatsThis::add( w, whatsThis ); + Attr_list *attr = new Attr_list(el, w, dtdTag); + attributes.append(attr); + if (!m_firstItem) + m_firstItem = w; + } else + if ( type == "color" ) + { + ColorCombo *w = new ColorCombo(this); + grid->addMultiCellWidget( w, row, row+rowspan, col, col+colspan ); + + if ( !tip.isNull() ) + QToolTip::add( w, tip ); + if ( !whatsThis.isNull() ) + QWhatsThis::add( w, whatsThis ); + + Attr_color *attr = new Attr_color(el, w, m_dtdTag); + attributes.append(attr); + if (!m_firstItem) + m_firstItem = w; + } else + if ( type == "url" ) + { + FileCombo *w = new FileCombo(baseURL, this); + grid->addMultiCellWidget( w, row, row+rowspan, col, col+colspan ); + + if ( !tip.isNull() ) + QToolTip::add( w, tip ); + if ( !whatsThis.isNull() ) + QWhatsThis::add( w, whatsThis ); + Attr_file *attr = new Attr_file(el, w, m_dtdTag); + attributes.append(attr); + if (!m_firstItem) + m_firstItem = w; + } + + else + if ( type == "css-style" ) + { + StyleEditor *w = new StyleEditor(this); + grid->addMultiCellWidget( w, row, row+rowspan, col, col+colspan ); + + if ( !tip.isNull() ) + QToolTip::add( w, tip ); + if ( !whatsThis.isNull() ) + QWhatsThis::add( w, whatsThis ); + + Attr_line *attr = new Attr_line(el, w->lineEdit(), m_dtdTag); + attributes.append(attr); + + if (!m_firstItem) + m_firstItem = w; + + } + + } + + if ( n.nodeName() == "spacer") + { + QDomElement el = n.toElement(); + + QSpacerItem* spacer; + + if ( el.attribute("orientation","v") == "v" ) + spacer = new QSpacerItem( 5, 10, QSizePolicy::Fixed, QSizePolicy::Expanding ); + else + spacer = new QSpacerItem( 10, 5, QSizePolicy::Expanding, QSizePolicy::Fixed ); + grid->addItem(spacer,row,col); + } + + } +} + +void Tagxml::focusToFirstItem() +{ + if(m_firstItem) + m_firstItem->setFocus(); +} + +void Tagxml::readAttributes( QDict<QString> *d ) +{ + QString name,value; + + Attr * attr = attributes.first(); + while ( attr ) { + name = attr->attrName(); + value = attr->value(); + + if ( value.isEmpty() ) + d->remove(name); + else + { + if ( dynamic_cast<Attr_check *>(attr) ) // checkbox + { + if (value == "checked") + { + if (m_dtd->booleanAttributes == "simple") + { + d->replace(name, new QString("") ); + } else + { + d->replace(name, new QString(m_dtd->booleanTrue)); //it seems that browsers don't like <input disabled="false">, so if a checkbox is false, don't put in the tag at all + } + } + else + { + d->remove(name); + } +/* } else + { + value = (value == "checked")?m_dtd->booleanTrue:m_dtd->booleanFalse; + d->replace(name, new QString(value)); + } */ + } else + if (dynamic_cast<Attr_file *>(attr)) + { +// value = KURL::encode_string(value); + d->replace(name, new QString(value)); + } else { + value.replace(QRegExp("&(?!amp;)"), "&"); + d->replace(name, new QString(value) ); + } + } + + + attr = attributes.next(); + } + +} + +void Tagxml::writeAttributes( QDict<QString> *d ) +{ + QString name,value; + + Attr * attr = attributes.first(); + + int count = 0; + while ( attr ) { + + name = attr->attrName(); + + QString *v = d->find(name); + if ( v ) { + v->replace("&","&"); + if ( dynamic_cast<Attr_check *>(attr) ) // checkbox + value = "checked"; + else + if ( dynamic_cast<Attr_file *>(attr)) + value = KURL::decode_string(*v); + else + value = *v; + } + else + { + value = ""; + + Attribute* attrib = m_dtdTag->attribute(name); + if(attrib && attrib->source.lower() == "selection") + value = m_selection; + } + + attr->setValue( value ); + + attr = attributes.next(); + ++count; + } +} + +#include "tagxml.moc" diff --git a/quanta/dialogs/tagdialogs/tagxml.h b/quanta/dialogs/tagdialogs/tagxml.h new file mode 100644 index 00000000..52c2973d --- /dev/null +++ b/quanta/dialogs/tagdialogs/tagxml.h @@ -0,0 +1,56 @@ +/*************************************************************************** + tagxml.h - description + ------------------- + begin : � � 25 14:34:07 EEST 2000 + copyright : (C) 2000 by Dmitry Poplavsky & Alexander Yakovlev & Eric Laffoon <pdima@users.sourceforge.net,yshurik@penguinpowered.com,sequitur@easystreet.com> + (C) 2003, 2004 by Andras Mantia <amantia@kde.org> + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef TAGXML_H +#define TAGXML_H + +#include <qwidget.h> +#include <qdom.h> +#include <qptrlist.h> + +#include "tagattr.h" +#include "tagwidget.h" +#include "qtag.h" + +class Tagxml : public QWidget, TagWidget { + Q_OBJECT + public: + /** construtor */ + Tagxml(QDomNode &d, QTag *dtdTag, QWidget* parent=0, const char *name=0); + Tagxml(QDomNode &d, QTag *dtdTag, const QString& selection, QWidget* parent=0, const char *name=0); + /** destructor */ + ~Tagxml(); + + QPtrList<Attr> attributes; + + void readAttributes( QDict<QString> *d); + void writeAttributes( QDict<QString> *d ); + void focusToFirstItem(); + + private: + void initialize(QDomNode &d, QTag *dtdTag); + + QDomNode doc; + const DTDStruct *m_dtd; + QWidget *m_firstItem; + QTag *m_dtdTag; + QString m_selection; +}; + + + +#endif |