void ModelTreeDialog::modelAlertCallback(TCAlert *alert) { if (alert->getSender() == m_modelWindow) { if (ucstrcmp(alert->getMessageUC(), _UC("ModelLoaded")) == 0) { setModel(m_modelWindow->getModelViewer()->getMainModel()); fillTreeView(); } else if (ucstrcmp(alert->getMessageUC(), _UC("ModelLoadCanceled")) == 0) { setModel(NULL); fillTreeView(); } } }
void ModelTreeDialog::show(ModelWindow *modelWindow, HWND hParentWnd /*= NULL*/) { setModelWindow(modelWindow); if (hWindow == NULL) { createDialog(IDD_MODELTREE, hParentWnd); } ShowWindow(hWindow, SW_SHOW); fillTreeView(); }
ManageCompletionFilesDialog::ManageCompletionFilesDialog(const QString& caption, const QString &localCompletionDir, const QString &globalCompletionDir, QWidget* parent, const char* name) : KDialog(parent), m_localCompletionDirectory(localCompletionDir), m_globalCompletionDirectory(globalCompletionDir) { setObjectName(name); setCaption(caption); setModal(true); setButtons(Ok | User1 | User2 | Cancel); setDefaultButton(Ok); showButtonSeparator(true); setButtonText(Ok, i18n("Add selected files")); setButtonToolTip(Ok, i18n("Add all the selected files")); setButtonText(User1, i18n("Install custom files...")); setButtonToolTip(User1, i18n("Install your own completion files")); setButtonText(User2, i18n("Manage custom files...")); setButtonToolTip(User2, i18n("Manage the local completion files in the file manager")); m_listView = new QTreeWidget(this); m_listView->setHeaderLabels(QStringList() << i18n("File Name") << i18n("Local File") << i18n("Add File?")); m_listView->setSortingEnabled(false); m_listView->setSelectionMode(QAbstractItemView::NoSelection); m_listView->setRootIsDecorated(false); m_dirWatcher = new KDirWatch(this); if (m_dirWatcher) { m_dirWatcher->addDir(localCompletionDir, KDirWatch::WatchFiles); connect(m_dirWatcher, SIGNAL(created(QString)), this, SLOT(fillTreeView())); connect(m_dirWatcher, SIGNAL(deleted(QString)), this, SLOT(fillTreeView())); } connect(this, SIGNAL(user1Clicked()), this, SLOT(addCustomCompletionFiles())); connect(this, SIGNAL(user2Clicked()), this, SLOT(openLocalCompletionDirectoryInFileManager())); fillTreeView(); setMainWidget(m_listView); }