NewResourceAssistant::NewResourceAssistant(ResourceModel* resourceModel, QWidget* parent) : KAssistantDialog(parent), m_resourceModel(resourceModel), m_resourceTypesWidget(new ResourceTypesWidget(this)), m_newCourseWidget(new NewCourseWidget(m_resourceModel, this)), m_newKeyboardLayoutWidget(new NewKeyboardLayoutWidget(m_resourceModel, this)), m_resourceTemplateWidget(new ResourceTemplateWidget(m_resourceModel, this)) { setWindowTitle(i18n("New")); m_resourceTypesPage = addPage(m_resourceTypesWidget, i18n("New...")); setValid(m_resourceTypesPage, false); m_newCoursePage = addPage(m_newCourseWidget, i18n("New course")); setValid(m_newCoursePage, false); setAppropriate(m_newCoursePage, false); m_newKeyboardLayoutPage = addPage(m_newKeyboardLayoutWidget, i18n("New keyboard layout")); setValid(m_newKeyboardLayoutPage, false); setAppropriate(m_newKeyboardLayoutPage, false); m_resourceTemplatePage = addPage(m_resourceTemplateWidget, i18n("Template")); setValid(m_resourceTemplatePage, false); connect(m_resourceTypesWidget, SIGNAL(typeSelected(ResourceModel::ResourceItemType)), SLOT(setResourceType(ResourceModel::ResourceItemType))); connect(m_newCourseWidget, SIGNAL(isValidChanged()), SLOT(updateNewCoursePageValidity())); connect(m_newKeyboardLayoutWidget, SIGNAL(isValidChanged()), SLOT(updateNewKeyboardLayoutPageValidity())); connect(m_resourceTemplateWidget, SIGNAL(isValidChanged()), SLOT(updateResourceTemplatePageValidity())); }
void NewResourceAssistant::setResourceType(ResourceModel::ResourceItemType type) { m_resourceType = type; setAppropriate(m_newCoursePage, type == ResourceModel::CourseItem); setAppropriate(m_newKeyboardLayoutPage, type == ResourceModel::KeyboardLayoutItem); m_resourceTemplateWidget->setTemplateType(type); setValid(m_resourceTypesPage, true); }
void ConnectionWizard::setState(bool patch, bool end, bool back, bool next, bool finish) { setAppropriate(pagePatch, patch ? true : false); setAppropriate(pageEnd, end ? true : false); backButton()->setEnabled(back ? true : false); nextButton()->setEnabled(next ? true : false); finishButton()->setEnabled(finish ? true : false); }
void KraftWizard::setDocIdentifier( const QString& ident ) { // we already know the customer, disable the customer select page. setAppropriate( mCustomerPageItem, false ); if ( mDetailsPage->mCustomerLabel ) { mDetailsPage->mCustomerLabel->setText( ident ); } }
AddAccountAssistant::AddAccountAssistant(Tp::AccountManagerPtr accountManager, QWidget *parent) : KAssistantDialog(parent), d(new Private) { d->accountManager = accountManager; d->globalPresence = new KTp::GlobalPresence(this); d->globalPresence->setAccountManager(accountManager); // Set up the pages of the Assistant. d->profileListModel = new ProfileListModel(this); d->profileSelectWidget = new ProfileSelectWidget(d->profileListModel, this, true); d->simpleProfileSelectWidget = new SimpleProfileSelectWidget(d->profileListModel, this); d->pageOne = new KPageWidgetItem(d->simpleProfileSelectWidget); d->pageTwo = new KPageWidgetItem(d->profileSelectWidget); d->pageOne->setHeader(i18n("Step 1: Select an Instant Messaging Network.")); d->pageTwo->setHeader(i18n("Step 1: Select an Instant Messaging Network.")); setValid(d->pageOne, false); setValid(d->pageTwo, false); connect(d->profileSelectWidget, SIGNAL(profileSelected(bool)), SLOT(onProfileSelected(bool))); connect(d->profileSelectWidget, SIGNAL(profileChosen()), SLOT(goToPageThree())); connect(d->simpleProfileSelectWidget, SIGNAL(profileChosen()), SLOT(goToPageThree())); connect(d->simpleProfileSelectWidget, SIGNAL(othersChosen()), SLOT(goToPageTwo())); // we will build the page widget later, but the constructor of // KPageWidgetItem requires the widget at this point, so... d->pageThreeWidget = new QWidget(this); new QHBoxLayout(d->pageThreeWidget); d->pageThree = new KPageWidgetItem(d->pageThreeWidget); d->pageThree->setHeader(i18n("Step 2: Fill in the required Parameters.")); addPage(d->pageOne); addPage(d->pageTwo); addPage(d->pageThree); setAppropriate(d->pageTwo, false); // TODO re-enable the help when we will have one showButton(KDialog::Help, false); }
void Wizard::slotThemeSelectionChanged() { KListWidget* listWidget = d->mThemePage->mThemeList; KTextBrowser* browser = d->mThemePage->mThemeInfo; if (listWidget->currentItem()) { Theme::Ptr theme=static_cast<ThemeListBoxItem*>(listWidget->currentItem())->mTheme; QString url = theme->authorUrl(); QString author = theme->authorName(); bool allowNonsquareThumbnails=theme->allowNonsquareThumbnails(); if (!url.isEmpty()) { author=QString("<a href='%1'>%2</a>").arg(url).arg(author); } QString preview = theme->previewUrl(); QString image = ""; if (!preview.isEmpty()) { image=QString("<img src='%1/%2' /><br/><br/>").arg(theme->directory(), theme->previewUrl()); } QString txt= image + QString("<b>%3</b><br/><br/>%4<br/><br/>").arg(theme->name(), theme->comment()) + i18n("Author: %1", author); browser->setHtml(txt); setValid(d->mThemePage->page(), true); // Enable theme parameter page if there is any parameter Theme::ParameterList parameterList = theme->parameterList(); setAppropriate(d->mThemeParametersPage->page(), parameterList.size() > 0); d->mImageSettingsPage->kcfg_thumbnailSquare->setEnabled(allowNonsquareThumbnails); if (!allowNonsquareThumbnails) d->mImageSettingsPage->kcfg_thumbnailSquare->setChecked(true); d->fillThemeParametersPage(theme); } else { browser->clear(); setValid(d->mThemePage->page(), false); } }
kiptablesgenerator::kiptablesgenerator(QWidget *parent, const char *name) : KWizard(parent, name) { setupNewForwardDialog(); setupNewServiceDialog(); setupNewHostDialog(); setupWelcomePage(); setupInterfacesPage(); setupIncomingPage(); setAppropriate(incomingPage, false); // don't show this page setupIPolicyPage(); setupIHostsPage(); setupIConntrackPage(); setupIPortsPage(); setupFForwardingPage(); setupIDefensiveChecksPage(); setupFinishedPage(); helpButton()->hide(); }
MainWindow::MainWindow() : QMainWindow( 0, "MainWindow", WDestructiveClose ) { QDockWindow * pNMWindow; std::map<QString, ServerCreator>::iterator iterCreator; m_pCentralWidget = new QWorkspace(this, "CENTRALWIDGET"); m_pCentralWidget->setScrollBarsEnabled(true); setIcon(app32x32_xpm); setCentralWidget(m_pCentralWidget); // create menus m_pFileMenu = new QPopupMenu(this, "File Menu"); m_pFileNew = new QAction("&New...", QAccel::stringToKey("Ctrl+N"), this, "file.new"); m_pFileNew->setToolTip("Create a new simulation file, ending the current simulation"); connect(m_pFileNew, SIGNAL(activated()), this, SLOT(OnFileNew())); m_pFileNew->addTo(m_pFileMenu); m_pFileEdit = new QAction("&Edit...", QAccel::stringToKey("Ctrl+E"), this, "file.edit"); m_pFileEdit->setToolTip("Edit the current simulation file, ending the current simulation"); connect(m_pFileEdit, SIGNAL(activated()), this, SLOT(OnFileEdit())); m_pFileEdit->setEnabled(false); m_pFileEdit->addTo(m_pFileMenu); m_pFileOpen = new QAction(QPixmap(fileopen), "&Open...", QAccel::stringToKey("Ctrl+O"), this, "file.open"); m_pFileOpen->setToolTip("Open a simulation file, ending the current simulation"); connect(m_pFileOpen, SIGNAL(activated()), this, SLOT(OnFileOpen())); m_pFileOpen->addTo(m_pFileMenu); m_pFileSave = new QAction(QPixmap(filesave), "&Save As...", QAccel::stringToKey("Ctrl+S"), this, "file.save"); m_pFileSave->setToolTip("Save the current setup to a simulation file (this ends any running simulation)"); connect(m_pFileSave, SIGNAL(activated()), this, SLOT(OnFileSave())); m_pFileSave->setEnabled(false); m_pFileSave->addTo(m_pFileMenu); m_pFileMenu->insertSeparator(); m_pFileConfig = new QAction("&Configure...", QKeySequence(), this, "file.config"); m_pFileConfig->setToolTip("Edit the current configuration"); connect(m_pFileConfig, SIGNAL(activated()), this, SLOT(OnFileConfig())); m_pFileConfig->addTo(m_pFileMenu); m_pFileExit = new QAction("E&xit...", QAccel::stringToKey("Ctrl+Q"), this, "file.exit"); m_pFileExit->setToolTip("Exit the program"); connect(m_pFileExit, SIGNAL(activated()), this, SLOT(OnFileExit())); m_pFileExit->addTo(m_pFileMenu); m_pSimMenu = new QPopupMenu(this, "Sim Menu"); m_pSimRun = new QAction("&Run...", QKeySequence(Qt::Key_F2), this, "sim.run"); m_pSimRun->setToolTip("Start a new simulation"); connect(m_pSimRun, SIGNAL(activated()), this, SLOT(OnSimRun())); m_pSimRun->setEnabled(false); m_pSimRun->addTo(m_pSimMenu); m_pSimPause = new QAction("Pause", QKeySequence(Qt::Key_F3), this, "sim.pause"); m_pSimPause->setToolTip("Pause the currently running simulation"); m_pSimPause->setEnabled(false); connect(m_pSimPause, SIGNAL(activated()), this, SLOT(OnSimPause())); m_pSimPause->addTo(m_pSimMenu); m_pSimSkip = new QAction("Skip to next", QKeySequence(), this, "sim.skip"); m_pSimSkip->setToolTip("Skip to the next Monte Carlo iteration of the simulation"); m_pSimSkip->setEnabled(false); connect(m_pSimSkip, SIGNAL(activated()), this, SLOT(OnSimSkip())); m_pSimSkip->addTo(m_pSimMenu); m_pSimStop = new QAction("&Stop", QKeySequence(Qt::SHIFT | Qt::Key_F2), this, "sim.stop"); m_pSimStop->setToolTip("Stop the currently running simulation"); m_pSimStop->setEnabled(false); connect(m_pSimStop, SIGNAL(activated()), this, SLOT(OnSimStop())); m_pSimStop->addTo(m_pSimMenu); m_pNetMenu = new QPopupMenu(this, "Net Menu"); m_pNetInit = new QAction("&Initialize", QKeySequence(), this, "net.init"); m_pNetInit->setToolTip("Initialize network devices and connections"); m_pNetInit->setEnabled(true); connect(m_pNetInit, SIGNAL(activated()), this, SLOT(OnNetInit())); m_pNetInit->addTo(m_pNetMenu); m_pNetClose = new QAction("&Close", QKeySequence(), this, "net.close"); m_pNetClose->setToolTip("Close network devices and connections"); m_pNetClose->setEnabled(false); connect(m_pNetClose, SIGNAL(activated()), this, SLOT(OnNetClose())); m_pNetClose->addTo(m_pNetMenu); m_pNetServer = new QAction("&Stop Server", QKeySequence(), this, "net.server"); m_pNetServer->setToolTip("Stop GrooveNet server"); connect(m_pNetServer, SIGNAL(activated()), this, SLOT(OnNetServer())); m_pNetServerMenu = new QPopupMenu(this, "startserver"); connect(m_pNetServerMenu, SIGNAL(activated(int)), this, SLOT(OnNetServer(int))); for (iterCreator = g_mapServerCreators.begin(); iterCreator != g_mapServerCreators.end(); ++iterCreator) m_pNetServerMenu->insertItem(iterCreator->first); m_iNetServerMenuID = m_pNetMenu->insertItem("&Start Server", m_pNetServerMenu); m_pWindowMenu = new QPopupMenu(this, "Window Menu"); m_pWindowCascade = new QAction("&Cascade", QKeySequence(), this, "window.cascade"); m_pWindowCascade->setToolTip("Cascade all open windows"); connect(m_pWindowCascade, SIGNAL(activated()), m_pCentralWidget, SLOT(cascade())); m_pWindowCascade->addTo(m_pWindowMenu); m_pWindowTile = new QAction("&Tile", QKeySequence(), this, "window.tile"); m_pWindowTile->setToolTip("Tile all open windows"); connect(m_pWindowTile, SIGNAL(activated()), m_pCentralWidget, SLOT(tile())); m_pWindowTile->addTo(m_pWindowMenu); m_pWindowCloseAll = new QAction("Close &All Windows", QKeySequence(), this, "window.closeall"); m_pWindowCloseAll->setToolTip("Close all open windows"); connect(m_pWindowCloseAll, SIGNAL(activated()), m_pCentralWidget, SLOT(closeAllWindows())); m_pWindowCloseAll->addTo(m_pWindowMenu); menuBar()->insertItem("&File", m_pFileMenu); menuBar()->insertItem("&Simulator", m_pSimMenu); menuBar()->insertItem("&Network", m_pNetMenu); menuBar()->insertItem("&Window", m_pWindowMenu); statusBar()->addWidget(m_pLblStatus = new QLabel("Ready", this, "statusbar.label"), 1); statusBar()->setSizeGripEnabled(true); /* pNMWindow = new QDockWindow(this); pNMWindow->setCaption("Network Manager"); pNMWindow->setHorizontallyStretchable(true); pNMWindow->setVerticallyStretchable(false); pNMWindow->setResizeEnabled(true); pNMWindow->setMovingEnabled(true); pNMWindow->setCloseMode(QDockWindow::Always); m_pNetworkManager = new QNetworkManager(pNMWindow, "network manager"); pNMWindow->setWidget(m_pNetworkManager); addDockWindow(pNMWindow, Qt::DockBottom, true); */ tabsContainer = new QToolBar(this); tabsWidget = new QTabWidget(tabsContainer, "tabs"); tabsWidget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); tabsWidget->setMargin(8); tabsContainer->setStretchableWidget(tabsWidget); tabsContainer->setLabel(tr("GrooveNet - Tooltabs")); addDockWindow(tabsContainer, Qt::DockBottom, TRUE); m_pNetworkManager = new QNetworkManager(tabsContainer, "network manager"); tabsWidget->addTab(m_pNetworkManager, QString("Network Manager")); m_pMessageList = new QMessageList(tabsContainer, "message list"); tabsWidget->addTab(m_pMessageList, QString("Messages")); setAppropriate(tabsContainer, false); tabsWidget->addTab(NULL, QString("Congestion Info")); tabsWidget->addTab(NULL, QString("Playback")); }
void OpenProjectDialog::validateOpenUrl( const QUrl& url_ ) { bool isDir = false; QString extension; bool isValid = false; const QUrl url = url_.adjusted(QUrl::StripTrailingSlash); if( url.isLocalFile() ) { QFileInfo info( url.toLocalFile() ); isValid = info.exists(); if ( isValid ) { isDir = info.isDir(); extension = info.suffix(); } } else if ( url.isValid() ) { KIO::StatJob* statJob = KIO::stat( url, KIO::HideProgressInfo ); KJobWidgets::setWindow(statJob, Core::self()->uiControllerInternal()->defaultMainWindow() ); isValid = statJob->exec(); // TODO: do this asynchronously so that the user isn't blocked while typing every letter of the hostname in sftp://hostname if ( isValid ) { KIO::UDSEntry entry = statJob->statResult(); isDir = entry.isDir(); extension = QFileInfo( entry.stringValue( KIO::UDSEntry::UDS_NAME ) ).suffix(); } } if ( isValid ) { // reset header openPage->setHeader(i18n("Open \"%1\" as project", url.fileName())); } else { // report error KColorScheme scheme(palette().currentColorGroup()); const QString errorMsg = i18n("Selected URL is invalid"); openPage->setHeader(QStringLiteral("<font color='%1'>%2</font>") .arg(scheme.foreground(KColorScheme::NegativeText).color().name(), errorMsg) ); setAppropriate( projectInfoPage, false ); setAppropriate( openPage, true ); setValid( openPage, false ); return; } if( isDir || extension != ShellExtension::getInstance()->projectFileExtension() ) { setAppropriate( projectInfoPage, true ); m_url = url; if( !isDir ) { m_url = m_url.adjusted(QUrl::StripTrailingSlash | QUrl::RemoveFilename); } ProjectInfoPage* page = qobject_cast<ProjectInfoPage*>( projectInfoPage->widget() ); if( page ) { page->setProjectName( m_url.fileName() ); OpenProjectPage* page2 = qobject_cast<OpenProjectPage*>( openPage->widget() ); if( page2 ) { // Default manager page->setProjectManager( QStringLiteral("Generic Project Manager") ); // clear the filelist m_fileList.clear(); if( isDir ) { // If a dir was selected fetch all files in it KIO::ListJob* job = KIO::listDir( m_url ); connect( job, &KIO::ListJob::entries, this, &OpenProjectDialog::storeFileList); KJobWidgets::setWindow(job, Core::self()->uiController()->activeMainWindow()); job->exec(); } else { // Else we'lll just take the given file m_fileList << url.fileName(); } // Now find a manager for the file(s) in our filelist. bool managerFound = false; foreach( const QString& manager, page2->projectFilters().keys() ) { foreach( const QString& filterexp, page2->projectFilters().value(manager) ) { if( !m_fileList.filter( QRegExp( filterexp, Qt::CaseSensitive, QRegExp::Wildcard ) ).isEmpty() ) { managerFound = true; break; } } if( managerFound ) { page->setProjectManager( manager ); break; } } } } m_url.setPath( m_url.path() + '/' + m_url.fileName() + '.' + ShellExtension::getInstance()->projectFileExtension() ); } else