//----------------------------------------------------------------------------- //! //----------------------------------------------------------------------------- // Select by category popup void tSiriusController::SelectCategory() { // Get the subscribed list const QList<tChannelRecord *>& chanList = GetSubscribedChannelList(); if ( chanList.isEmpty() ) { // Assert(chanList.size() > 0); // Must be at least the currently playing channel tMessageBox::Error( 0, tr( "Categories"), tr( "No channels"), tMessageBox::CLOSE ); return; } m_pSelectCategoryDialog = new tListenDialog(tr("Channels") + QString(" - ") + tr("Categories"), 0, true, true); m_pCategoryTable = new tCategorySelect(); //not sure Cougar needs this Connect(m_pCategoryTable, SIGNAL(NewSiriusCategorySelectedByUser(QString&)), m_pSelectCategoryDialog, SLOT(OnNewSiriusCategorySelectedByUser(QString&))); m_pCategoryTable->SetRecords(chanList, m_ChannelId); // Close the dialog on channel selected Connect(m_pCategoryTable, SIGNAL(activated(const QModelIndex&)), this, SLOT(TuneToHighlightedChannelFromCategory())); Connect(m_pSelectCategoryDialog, SIGNAL(accepted()), this, SLOT(TuneToHighlightedChannelAndAcceptFromCategory())); Connect(this, SIGNAL(FavoriteUpdated(const bool)), m_pSelectCategoryDialog, SLOT(OnFavoriteUpdated(const bool))); Connect(m_pCategoryTable, SIGNAL(NewFocusRow(const int)), this, SLOT(OnNewFocusRow(const int))); Connect(m_pSelectCategoryDialog, SIGNAL(ToggleFavoriteMenuSelected()), m_pCategoryTable, SLOT(ToggleFavorite())); // Close the dialog on cancel Connect(m_pCategoryTable, SIGNAL(Cancel()), m_pSelectCategoryDialog, SLOT(reject())); Connect(m_pSelectCategoryDialog, SIGNAL(WheelIndicatesScrollUp()), m_pCategoryTable, SLOT(OnWheelIndicatesScrollUp())); Connect(m_pSelectCategoryDialog, SIGNAL(WheelIndicatesScrollDown()), m_pCategoryTable, SLOT(OnWheelIndicatesScrollDown())); Connect(m_pSelectCategoryDialog, SIGNAL(NextCategoryMenuSelected()), m_pCategoryTable, SLOT(NextCategory())); Connect(m_pSelectCategoryDialog, SIGNAL(PreviousCategoryMenuSelected()), m_pCategoryTable, SLOT(PrevCategory())); // Layout QVBoxLayout* pLayout = new QVBoxLayout; pLayout->addWidget(m_pCategoryTable); m_pSelectCategoryDialog->setLayout(pLayout); Connect(m_pCategoryTable, SIGNAL(RowLocationPossiblyChanged(const QRect)), m_pSelectCategoryDialog, SLOT(OnRowLocationPossiblyChanged(const QRect))); m_pSelectCategoryDialog->exec(); delete m_pSelectCategoryDialog; m_pSelectCategoryDialog = 0; // delete m_pCategoryTable; we do not need to do this, it is owned by the dialog m_pCategoryTable = 0; }
void keyServer::slotSearch() { if (page->kCBimportks->currentText().isEmpty()) return; if (page->kLEimportid->text().isEmpty()) { KMessageBox::sorry(this,i18n("You must enter a search string.")); return; } //listpop = new KeyServer( this,"result",WType_Dialog | WShowModal); dialogServer=new KDialogBase(KDialogBase::Swallow, i18n("Import Key From Keyserver"), KDialogBase::Ok | KDialogBase::Close,KDialogBase::Ok,this,0,true); dialogServer->setButtonText(KDialogBase::Ok,i18n("&Import")); dialogServer->enableButtonOK(false); listpop=new searchRes(); listpop->kLVsearch->setColumnWidthMode(0,QListView::Manual); listpop->kLVsearch->setColumnWidthMode(1,QListView::Manual); listpop->kLVsearch->setColumnWidth(0,150); listpop->kLVsearch->setColumnWidth(1,130); listpop->statusText->setText(i18n("Connecting to the server...")); connect(listpop->kLVsearch,SIGNAL(selectionChanged()),this,SLOT(transferKeyID())); connect(dialogServer,SIGNAL(okClicked()),this,SLOT(preimport())); connect(listpop->kLVsearch,SIGNAL(doubleClicked(QListViewItem *,const QPoint &,int)),dialogServer,SIGNAL(okClicked())); connect(dialogServer,SIGNAL(closeClicked()),this,SLOT(handleQuit())); connect( listpop , SIGNAL( destroyed() ) , this, SLOT( abortSearch())); count=0; cycle=false; readmessage=QString::null; searchproc=new KProcIO(QTextCodec::codecForLocale()); QString keyserv=page->kCBimportks->currentText(); *searchproc<<"gpg"<<"--utf8-strings"; if (page->cBproxyI->isChecked()) { searchproc->setEnvironment("http_proxy",page->kLEproxyI->text()); *searchproc<< "--keyserver-options"<<"honor-http-proxy"; } else *searchproc<< "--keyserver-options"<<"no-honor-http-proxy"; *searchproc<<"--keyserver"<<keyserv<<"--command-fd=0"<<"--status-fd=2"<<"--search-keys"<<page->kLEimportid->text().stripWhiteSpace(); keyNumbers=0; QObject::connect(searchproc, SIGNAL(processExited(KProcess *)),this, SLOT(slotsearchresult(KProcess *))); QObject::connect(searchproc, SIGNAL(readReady(KProcIO *)),this, SLOT(slotsearchread(KProcIO *))); searchproc->start(KProcess::NotifyOnExit,true); QApplication::setOverrideCursor(QCursor(Qt::BusyCursor)); dialogServer->setMainWidget(listpop); listpop->setMinimumSize(listpop->sizeHint()); listpop->setMinimumWidth(550); dialogServer->exec(); }
int WebDialogProvider::getInteger(QWidget *parent, const QString &title, const QString &label, int value, int minValue, int maxValue, int step, bool *ok, Qt::WindowFlags flags) { WebDialogProviderValidatedSpinBox *sb = new WebDialogProviderValidatedSpinBox(minValue, maxValue, step, value); WebDialogProvider dlg(title, label, parent, sb, flags); connect(sb, SIGNAL(textChanged(bool)), dlg.okButton, SLOT(setEnabled(bool))); bool accepted = (dlg.exec() == QDialog::Accepted); if (ok) { *ok = accepted; } return sb->value(); }
void newRequestNoParams() { QVERIFY(this->so->write(binaryBeginRequest(1, 1, 0)) > 0); QVERIFY(this->so->write(binaryParam(1, QByteArray())) > 0); QSignalSpy spy(this->fcgi, SIGNAL(newRequest(QFCgiRequest*))); QObject::connect(this->fcgi, SIGNAL(newRequest(QFCgiRequest*)), loop, SLOT(quit())); loop->exec(); QFCgiRequest *request = qvariant_cast<QFCgiRequest*>(spy.at(0).at(0)); QVERIFY(request != 0); QCOMPARE(request->getParams().count(), 0); request->endRequest(0); }
//----------------------------------------------------------------------------- //! Activate the Select From subscribed or favorites channels menu item //----------------------------------------------------------------------------- void tSiriusController::SelectFromChannels(const QList<tChannelRecord *>& chanList, const QString& title, bool needFavoritesColumn) { // First get the subscribed list if ( chanList.isEmpty() ) { // Assert(chanList.size() > 0); // Must be at least the currently playing channel tMessageBox::Error( 0, tr("Subscribed"), tr("No channels"), tMessageBox::CLOSE ); return; } // If there is only 1 subscribed channel, it must be the the current channel // TODO the dialog should say "Call Sirius" m_pChannelsDialog = new tListenDialog(title, 0, needFavoritesColumn); m_pChannelsDialog->SetAlignment(tDialog::AlignScreenCenter); m_pChannelsTable = new tChannelSelect(0, needFavoritesColumn); m_pChannelsTable->SetRecords(chanList, m_ChannelId); // Close the dialog on channel selected Connect(m_pChannelsTable, SIGNAL(activated(const QModelIndex&)), this, SLOT(TuneToHighlightedChannelFromChannelsTable(const QModelIndex&))); Connect(m_pChannelsDialog, SIGNAL(accepted()), this, SLOT(TuneToHighlightedChannelAndAcceptFromChannelsTable())); Connect(this, SIGNAL(FavoriteUpdated(const bool)), m_pChannelsDialog, SLOT(OnFavoriteUpdated(const bool))); Connect(m_pChannelsTable, SIGNAL(NewFocusRow(const int)), this, SLOT(OnNewFocusRow(const int))); Connect(m_pChannelsDialog, SIGNAL(ToggleFavoriteMenuSelected()), m_pChannelsTable, SLOT(ToggleFavorite())); // Close the dialog on cancel Connect(m_pChannelsTable, SIGNAL(Cancel()), m_pChannelsDialog, SLOT(reject())); Connect(m_pChannelsDialog, SIGNAL(WheelIndicatesScrollUp()), m_pChannelsTable, SLOT(OnWheelIndicatesScrollUp())); Connect(m_pChannelsDialog, SIGNAL(WheelIndicatesScrollDown()), m_pChannelsTable, SLOT(OnWheelIndicatesScrollDown())); // Layout QVBoxLayout* pLayout = new QVBoxLayout; pLayout->addWidget(m_pChannelsTable); m_pChannelsDialog->setLayout(pLayout); Connect(m_pChannelsTable, SIGNAL(RowLocationPossiblyChanged(const QRect)), m_pChannelsDialog, SLOT(OnRowLocationPossiblyChanged(const QRect))); m_pChannelsDialog->exec(); delete m_pChannelsDialog; m_pChannelsDialog = 0; //delete m_pChannelsTable; we do not need to do this, it is owned by the dialog m_pChannelsTable = 0; }
//----------------------------------------------------------------------------- //! All channel status popup //----------------------------------------------------------------------------- void tSiriusController::AllChannelStatus() { const QList<tChannelInfo *>& chanList = m_rSiriusConnector.AllChannelList(); if ( chanList.isEmpty() ) { // Assert(chanList.size() > 0); // Must be at least the currently playing channel tMessageBox::Error( 0, tr( "All" ), tr( "No channels" ), tMessageBox::CLOSE ); return; } m_pAllChannelStatusDialog = new tListenDialog( tr("Channels") + QString(" - ") + tr("All"), 0, true); m_pAllChannelStatusDialog->SetAlignment(tDialog::AlignScreenCenter); m_pAllChannelStatusTable = new tAllChannelStatus(m_pAllChannelStatusDialog); Connect(m_pAllChannelStatusTable, SIGNAL(Cancel()), m_pAllChannelStatusDialog, SLOT(reject())); Connect(m_pAllChannelStatusTable, SIGNAL(activated(const QModelIndex&)), this, SLOT(TuneToHighlightedChannelFromAllChannelStatusTable())); Connect(m_pAllChannelStatusDialog, SIGNAL(accepted()), this, SLOT(TuneToHighlightedChannelAndAcceptFromAllChannelStatusTable())); Connect(this, SIGNAL(FavoriteUpdated(const bool)), m_pAllChannelStatusDialog, SLOT(OnFavoriteUpdated(const bool))); Connect(m_pAllChannelStatusTable, SIGNAL(NewFocusRow(const int)), this, SLOT(OnNewFocusRow(const int))); Connect(m_pAllChannelStatusDialog, SIGNAL(ToggleFavoriteMenuSelected()), m_pAllChannelStatusTable, SLOT(ToggleFavorite())); Connect(m_pAllChannelStatusDialog, SIGNAL(WheelIndicatesScrollUp()), m_pAllChannelStatusTable, SLOT(OnWheelIndicatesScrollUp())); Connect(m_pAllChannelStatusDialog, SIGNAL(WheelIndicatesScrollDown()), m_pAllChannelStatusTable, SLOT(OnWheelIndicatesScrollDown())); // Layout QVBoxLayout* pLayout = new QVBoxLayout; pLayout->addWidget(m_pAllChannelStatusTable); m_pAllChannelStatusDialog->setLayout(pLayout); m_pAllChannelStatusTable->SetRecords(chanList, m_ChannelId); Connect(m_pAllChannelStatusTable, SIGNAL(RowLocationPossiblyChanged(const QRect)), m_pAllChannelStatusDialog, SLOT(OnRowLocationPossiblyChanged(const QRect))); m_pAllChannelStatusDialog->exec(); delete m_pAllChannelStatusDialog; m_pAllChannelStatusDialog = 0; //delete m_pAllChannelStatusTable; we do not need to do this, it is owned by the dialog m_pAllChannelStatusTable = 0; }
void newRequestParamsOneRecord() { QVERIFY(this->so->write(binaryBeginRequest(1, 1, 0)) > 0); QByteArray params = encodeParam("k1", "v1").append(encodeParam("k2", "v2")); QVERIFY(this->so->write(binaryParam(1, params)) > 0); QVERIFY(this->so->write(binaryParam(1, QByteArray())) > 0); QSignalSpy spy(this->fcgi, SIGNAL(newRequest(QFCgiRequest*))); QObject::connect(this->fcgi, SIGNAL(newRequest(QFCgiRequest*)), loop, SLOT(quit())); loop->exec(); QFCgiRequest *request = qvariant_cast<QFCgiRequest*>(spy.at(0).at(0)); QVERIFY(request != 0); QCOMPARE(request->getParams().count(), 2); QCOMPARE(request->getParam("k1"), QString("v1")); QCOMPARE(request->getParam("k2"), QString("v2")); request->endRequest(0); }