/** * Handles a popup menu selection. */ void ObjectWidget::slotMenuSelection(QAction* action) { ListPopupMenu::MenuType sel = ListPopupMenu::typeFromAction(action); switch(sel) { case ListPopupMenu::mt_Rename_Object: { bool ok; QRegExpValidator* validator = new QRegExpValidator(QRegExp(QLatin1String(".*")), 0); #if QT_VERSION >= 0x050000 QString name = QInputDialog::getText(m_scene->activeView(), i18n("Rename Object"), i18n("Enter object name:"), QLineEdit::Normal, m_instanceName, &ok); #else QString name = KInputDialog::getText (i18n("Rename Object"), i18n("Enter object name:"), m_instanceName, &ok, m_scene->activeView(), validator); #endif if (ok) { m_instanceName = name; updateGeometry(); moveEvent(0); update(); UMLApp::app()->document()->setModified(true); } delete validator; break; } case ListPopupMenu::mt_Properties: showPropertiesDialog(); updateGeometry(); moveEvent(0); update(); break; case ListPopupMenu::mt_Up: tabUp(); break; case ListPopupMenu::mt_Down: tabDown(); break; default: UMLWidget::slotMenuSelection(action); break; } }
ViewConfigurationDialog::ViewConfigurationDialog(Project *project, QWidget *parent) : QDialog(parent), ui(new Ui::ViewConfigurationDialog), mProject(project) { ui->setupUi(this); mViewModel = new ViewsModel(mProject); ui->viewView->setModel( mViewModel ); mTabsModel = 0; mItemsModel = 0; mPhrasalGlossesModel = 0; mView = 0; mTab = 0; connect(ui->addView, SIGNAL(clicked()), this, SLOT(addView()) ); connect(ui->removeView, SIGNAL(clicked()), this, SLOT(removeView()) ); connect(ui->addTab, SIGNAL(clicked()), this, SLOT(addTab()) ); connect(ui->removeTab, SIGNAL(clicked()), this, SLOT(removeTab()) ); connect(ui->addItem, SIGNAL(clicked()), this, SLOT(addItem()) ); connect(ui->removeItem, SIGNAL(clicked()), this, SLOT(removeItem()) ); connect(ui->itemView, SIGNAL(activated(QModelIndex)), this, SLOT(editItem(QModelIndex)) ); connect(ui->addPhrasalGloss, SIGNAL(clicked()), this, SLOT(addPhrasalGloss()) ); connect(ui->removePhrasalGloss, SIGNAL(clicked()), this, SLOT(removePhrasalGloss()) ); connect(ui->phrasalGlossView, SIGNAL(activated(QModelIndex)), this, SLOT(editPhrasalGloss(QModelIndex)) ); connect(ui->viewView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(viewChanged(QItemSelection,QItemSelection))); connect(ui->itemWritingSystemsCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(indexLanguageChanged(int))); connect(ui->viewUp, SIGNAL(clicked()), this, SLOT(viewUp())); connect(ui->viewDown, SIGNAL(clicked()), this, SLOT(viewDown())); connect(ui->tabUp, SIGNAL(clicked()), this, SLOT(tabUp())); connect(ui->tabDown, SIGNAL(clicked()), this, SLOT(tabDown())); connect(ui->itemUp, SIGNAL(clicked()), this, SLOT(itemUp())); connect(ui->itemDown, SIGNAL(clicked()), this, SLOT(itemDown())); connect(ui->phrasalGlossUp, SIGNAL(clicked()), this, SLOT(phrasalGlossUp())); connect(ui->phrasalGlossDown, SIGNAL(clicked()), this, SLOT(phrasalGlossDown())); setTabWidgetsEnabled(false); setItemWidgetsEnabled(false); }
/** * Handles a popup menu selection. */ void ObjectWidget::slotMenuSelection(QAction* action) { ListPopupMenu::MenuType sel = ListPopupMenu::typeFromAction(action); switch(sel) { case ListPopupMenu::mt_Rename_Object: { QString name = m_instanceName; bool ok = Dialog_Utils::askName(i18n("Rename Object"), i18n("Enter object name:"), name); if (ok) { m_instanceName = name; updateGeometry(); moveEvent(0); update(); UMLApp::app()->document()->setModified(true); } break; } case ListPopupMenu::mt_Properties: showPropertiesDialog(); updateGeometry(); moveEvent(0); update(); break; case ListPopupMenu::mt_Up: tabUp(); break; case ListPopupMenu::mt_Down: tabDown(); break; default: UMLWidget::slotMenuSelection(action); break; } }