StatisticsDialog::StatisticsDialog ( StatisticsContact *contact, StatisticsDB *db, QWidget* parent ) : KDialog ( parent ), m_db ( db ), m_contact ( contact ) { setAttribute ( Qt::WA_DeleteOnClose, true ); setButtons ( KDialog::Close ); setDefaultButton ( KDialog::Close ); setCaption ( i18n ( "Statistics for %1", contact->metaContact()->displayName() ) ); QWidget * w = new QWidget ( this ); dialogUi = new Ui::StatisticsWidgetUI(); dialogUi->setupUi ( w ); setMainWidget ( w ); KHBox *generalHBox = new KHBox ( this ); generalHTMLPart = new KHTMLPart ( generalHBox ); connect ( generalHTMLPart->browserExtension(), SIGNAL (openUrlRequestDelayed(KUrl,KParts::OpenUrlArguments,KParts::BrowserArguments)), this, SLOT (slotOpenURLRequest(KUrl,KParts::OpenUrlArguments,KParts::BrowserArguments)) ); generalHTMLPart->setJScriptEnabled ( false ); generalHTMLPart->setJavaEnabled ( false ); generalHTMLPart->setMetaRefreshEnabled ( false ); generalHTMLPart->setPluginsEnabled ( false ); generalHTMLPart->setOnlyLocalReferences ( true ); dialogUi->tabWidget->insertTab ( 0, generalHBox, i18n ( "General" ) ); dialogUi->tabWidget->setCurrentIndex ( 0 ); KColorScheme scheme ( QPalette::Active, KColorScheme::View ); m_onlineColor = scheme.background ( KColorScheme::ActiveBackground ).color().darker(130); m_awayColor = scheme.background ( KColorScheme::NeutralBackground ).color().darker(130); m_offlineColor = scheme.background ( KColorScheme::AlternateBackground ).color().darker(130); m_backgroundColor = scheme.background ( KColorScheme::NormalBackground ).color().darker(130); m_textColor = scheme.foreground ( KColorScheme::NormalText ).color(); calendarHTMLPart = new KHTMLPart ( dialogUi->calendarHBox ); calendarHTMLPart->setJScriptEnabled ( false ); calendarHTMLPart->setJavaEnabled ( false ); calendarHTMLPart->setMetaRefreshEnabled ( false ); calendarHTMLPart->setPluginsEnabled ( false ); calendarHTMLPart->setOnlyLocalReferences ( true ); dialogUi->calendarKey->setTextFormat ( Qt::RichText ); dialogUi->calendarKey->setText ( i18n ( "Key: " "<font color=\"%1\">Online</font> " "<font color=\"%2\">Away</font> " "<font color=\"%3\">Offline</font>", m_onlineColor.name(), m_awayColor.name(), m_offlineColor.name() ) ); dialogUi->datePicker->setDate ( QDate::currentDate() ); connect ( dialogUi->datePicker, SIGNAL (dateChanged(QDate)), this, SLOT (fillCalendarCells()) ); connect ( dialogUi->datePicker, SIGNAL (dateChanged(QDate)), this, SLOT (generateOneDayStats()) ); setFocus(); setEscapeButton ( Close ); generatePageGeneral(); fillCalendarCells(); generateOneDayStats(); }
TestbedWebcamDialog::TestbedWebcamDialog( const QString &contactId, QWidget * parent, const char * name ) : KDialogBase( KDialogBase::Plain, Qt::WDestructiveClose, parent, name, false, i18n( "Webcam for %1" ).arg( contactId ), KDialogBase::Close, KDialogBase::Close, true /*seperator*/ ) { setInitialSize( QSize(320,290), false ); setEscapeButton( KDialogBase::Close ); // QObject::connect( this, SIGNAL( closeClicked() ), this, SIGNAL( closingWebcamDialog() ) ); QWidget *page = plainPage(); setMainWidget(page); QVBoxLayout *topLayout = new QVBoxLayout( page, 0, spacingHint() ); mImageContainer = new Kopete::WebcamWidget( page ); mImageContainer->setMinimumSize(320,240); mImageContainer->setText( i18n( "No webcam image received" ) ); mImageContainer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); topLayout->add( mImageContainer ); show(); mVideoDevicePool = Kopete::AV::VideoDevicePool::self(); mVideoDevicePool->open(); mVideoDevicePool->setSize(320, 240); mVideoDevicePool->startCapturing(); mVideoDevicePool->getFrame(); mVideoDevicePool->getImage(&mImage); kdDebug() << "Just captured 1st frame" << endl; mPixmap=QPixmap(320,240,-1, QPixmap::DefaultOptim); if (mPixmap.convertFromImage(mImage,0) == true) mImageContainer->updatePixmap(mPixmap); connect(&qtimer, SIGNAL(timeout()), this, SLOT(slotUpdateImage()) ); qtimer.start(0,FALSE); }
YahooVerifyAccount::YahooVerifyAccount(Kopete::Account *account, QWidget *parent, const char *name) : KDialogBase(parent, name, true, i18n("Account Verification - Yahoo"), Cancel|Apply, Apply, true ) { mTheAccount = account; mTheDialog = new YahooVerifyAccountBase( this ); mTheDialog->mPicture->hide(); setMainWidget( mTheDialog ); setEscapeButton( Cancel ); }
DiaryEntryDialog::DiaryEntryDialog(QWidget* parent) : KDialog(parent) { QWidget* w = new QWidget(this); m_designerUi.setupUi(w); setMainWidget(w); setCaption("New Diary Entry"); setButtons(KDialog::Ok | KDialog::Cancel); setEscapeButton(KDialog::Cancel); setDefaultButton(KDialog::Ok); }
IRCWebcamDialog::IRCWebcamDialog( const QString &contactId, QWidget * parent ) : KDialog( parent ) { setCaption( i18n( "Webcam for %1", contactId ) ); setButtons( KDialog::Close ); setDefaultButton( KDialog::Close ); showButtonSeparator( true ); setAttribute( Qt::WA_DeleteOnClose ); setInitialSize( QSize(320,290) ); setEscapeButton( KDialog::Close ); // QObject::connect( this, SIGNAL(closeClicked()), this, SIGNAL(closingWebcamDialog()) ); QWidget *page = new QWidget(this); setMainWidget(page); QVBoxLayout *topLayout = new QVBoxLayout( page ); mImageContainer = new Kopete::WebcamWidget( page ); mImageContainer->setMinimumSize(320,240); mImageContainer->setText( i18n( "No webcam image received" ) ); mImageContainer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); topLayout->addWidget( mImageContainer ); show(); #ifndef VIDEOSUPPORT_DISABLED mVideoDevicePool = Kopete::AV::VideoDevicePool::self(); mVideoDevicePool->open(); mVideoDevicePool->setImageSize(320, 240); mVideoDevicePool->startCapturing(); if (EXIT_SUCCESS == mVideoDevicePool->getFrame()) { mVideoDevicePool->getImage(&mImage); mPixmap=QPixmap::fromImage(mImage); if (!mPixmap.isNull()) mImageContainer->updatePixmap(mPixmap); } connect(&qtimer, SIGNAL(timeout()), this, SLOT(slotUpdateImage()) ); qtimer.setSingleShot(false); qtimer.start(0); #endif }
YahooInviteListImpl::YahooInviteListImpl(QWidget *parent) : KDialog(parent) { setButtons( KDialog::Cancel | KDialog::User1 ); setEscapeButton( KDialog::Cancel ); setButtonText( KDialog::User1, i18n("Invite") ); QWidget* w = new QWidget( this ); m_inviteWidget = new Ui::YahooInviteListBase(); m_inviteWidget->setupUi( w ); setMainWidget( w ); QObject::connect( this, SIGNAL(user1Clicked()), this, SLOT(slotInvite()) ); QObject::connect( m_inviteWidget->btn_Add, SIGNAL(clicked()), this, SLOT(slotAdd()) ); QObject::connect( m_inviteWidget->btn_Remove, SIGNAL(clicked()), this, SLOT(slotRemove()) ); QObject::connect( m_inviteWidget->btnCustomAdd, SIGNAL(clicked()), this, SLOT(slotAddCustom()) ); connect(this,SIGNAL(cancelClicked()),this,SLOT(slotCancel())); m_inviteWidget->listFriends->setSelectionMode( QAbstractItemView::ExtendedSelection ); m_inviteWidget->listInvited->setSelectionMode( QAbstractItemView::ExtendedSelection ); show(); }
KSnapshot::KSnapshot(QWidget *parent, const char *name, bool grabCurrent) : DCOPObject("interface"), KDialogBase(parent, name, true, QString::null, Help|User1, User1, true, KStdGuiItem::quit() ) { grabber = new QWidget( 0, 0, WStyle_Customize | WX11BypassWM ); grabber->move( -1000, -1000 ); grabber->installEventFilter( this ); KStartupInfo::appStarted(); QVBox *vbox = makeVBoxMainWidget(); mainWidget = new KSnapshotWidget( vbox, "mainWidget" ); connect(mainWidget, SIGNAL(startImageDrag()), SLOT(slotDragSnapshot())); connect( mainWidget, SIGNAL( newClicked() ), SLOT( slotGrab() ) ); connect( mainWidget, SIGNAL( saveClicked() ), SLOT( slotSaveAs() ) ); connect( mainWidget, SIGNAL( printClicked() ), SLOT( slotPrint() ) ); connect( mainWidget, SIGNAL( copyClicked() ), SLOT( slotCopy() ) ); grabber->show(); grabber->grabMouse( waitCursor ); if ( !grabCurrent ) snapshot = QPixmap::grabWindow( qt_xrootwin() ); else { mainWidget->setMode( WindowUnderCursor ); mainWidget->setIncludeDecorations( true ); performGrab(); } updatePreview(); grabber->releaseMouse(); grabber->hide(); KConfig *conf=KGlobal::config(); conf->setGroup("GENERAL"); mainWidget->setDelay(conf->readNumEntry("delay",0)); mainWidget->setMode( conf->readNumEntry( "mode", 0 ) ); mainWidget->setIncludeDecorations(conf->readBoolEntry("includeDecorations",true)); filename = KURL::fromPathOrURL( conf->readPathEntry( "filename", QDir::currentDirPath()+"/"+i18n("snapshot")+"1.png" )); // Make sure the name is not already being used while(KIO::NetAccess::exists( filename, false, this )) { autoincFilename(); } connect( &grabTimer, SIGNAL( timeout() ), this, SLOT( grabTimerDone() ) ); connect( &updateTimer, SIGNAL( timeout() ), this, SLOT( updatePreview() ) ); QTimer::singleShot( 0, this, SLOT( updateCaption() ) ); KHelpMenu *helpMenu = new KHelpMenu(this, KGlobal::instance()->aboutData(), false); QPushButton *helpButton = actionButton( Help ); helpButton->setPopup(helpMenu->menu()); KAccel* accel = new KAccel(this); accel->insert(KStdAccel::Quit, kapp, SLOT(quit())); accel->insert( "QuickSave", i18n("Quick Save Snapshot &As..."), i18n("Save the snapshot to the file specified by the user without showing the file dialog."), CTRL+SHIFT+Key_S, this, SLOT(slotSave())); accel->insert(KStdAccel::Save, this, SLOT(slotSaveAs())); // accel->insert(KShortcut(CTRL+Key_A), this, SLOT(slotSaveAs())); accel->insert( "SaveAs", i18n("Save Snapshot &As..."), i18n("Save the snapshot to the file specified by the user."), CTRL+Key_A, this, SLOT(slotSaveAs())); accel->insert(KStdAccel::Print, this, SLOT(slotPrint())); accel->insert(KStdAccel::New, this, SLOT(slotGrab())); accel->insert(KStdAccel::Copy, this, SLOT(slotCopy())); accel->insert( "Quit2", Key_Q, this, SLOT(slotSave())); accel->insert( "Save2", Key_S, this, SLOT(slotSaveAs())); accel->insert( "Print2", Key_P, this, SLOT(slotPrint())); accel->insert( "New2", Key_N, this, SLOT(slotGrab())); accel->insert( "New3", Key_Space, this, SLOT(slotGrab())); setEscapeButton( User1 ); connect( this, SIGNAL( user1Clicked() ), SLOT( reject() ) ); mainWidget->btnNew->setFocus(); }
AIMUserInfoDialog::AIMUserInfoDialog( Kopete::Contact *c, AIMAccount *acc, QWidget *parent ) : KDialog( parent ) { setCaption( i18n( "User Information on %1" , c->displayName() ) ); setButtons( KDialog::Cancel | KDialog::Ok ); setDefaultButton(KDialog::Ok); showButtonSeparator(true); kDebug(14200) << "for contact '" << c->contactId() << "'"; m_contact = c; mAccount = acc; QWidget* w = new QWidget( this ); mMainWidget = new Ui::AIMUserInfoWidget(); mMainWidget->setupUi( w ); setMainWidget( w ); QObject::connect(this, SIGNAL(okClicked()), this, SLOT(slotSaveClicked())); QObject::connect(this, SIGNAL(user1Clicked()), this, SLOT(slotUpdateClicked())); QObject::connect(this, SIGNAL(cancelClicked()), this, SLOT(slotCloseClicked())); QObject::connect(c, SIGNAL(updatedProfile()), this, SLOT(slotUpdateProfile())); QObject::connect(c, SIGNAL(statusMessageChanged( Kopete::Contact* )), this, SLOT(slotUpdateProfile())); mMainWidget->txtScreenName->setText( c->contactId() ); mMainWidget->txtNickName->setText( c->customName() ); if(m_contact == mAccount->myself()) // edit own account profile { mMainWidget->lblWarnLevel->hide(); mMainWidget->txtWarnLevel->hide(); mMainWidget->lblIdleTime->hide(); mMainWidget->txtIdleTime->hide(); mMainWidget->lblOnlineSince->hide(); mMainWidget->txtOnlineSince->hide(); mMainWidget->txtAwayMessage->hide(); mMainWidget->lblAwayMessage->hide(); userInfoView=0L; mMainWidget->userInfoFrame->setFrameStyle(QFrame::NoFrame | QFrame::Plain); QVBoxLayout *l = new QVBoxLayout(mMainWidget->userInfoFrame); l->setContentsMargins( 0, 0, 0, 0 ); userInfoEdit = new KTextEdit(QString(), mMainWidget->userInfoFrame); AIMMyselfContact* aimmc = dynamic_cast<AIMMyselfContact*>( c ); if ( aimmc ) userInfoEdit->setPlainText( aimmc->userProfile() ); else userInfoEdit->setPlainText( QString() ); setButtonText(Ok, i18n("&Save Profile")); showButton(User1, false); l->addWidget(userInfoEdit); } else { userInfoEdit=0L; mMainWidget->userInfoFrame->setFrameStyle(QFrame::NoFrame | QFrame::Plain); QVBoxLayout *l = new QVBoxLayout(mMainWidget->userInfoFrame); l->setContentsMargins( 0, 0, 0, 0 ); userInfoView = new KTextBrowser(mMainWidget->userInfoFrame); userInfoView->setObjectName("userInfoView"); userInfoView->setNotifyClick(true); QObject::connect( userInfoView, SIGNAL(urlClick(QString)), this, SLOT(slotUrlClicked(QString))); QObject::connect( userInfoView, SIGNAL(mailClick(QString,QString)), this, SLOT(slotMailClicked(QString,QString))); showButton(Cancel, false); setButtonText(Ok, i18n("&Close")); setEscapeButton(Ok); l->addWidget(userInfoView); if(m_contact->isOnline()) { // Update the user view to indicate that we're requesting the user's profile userInfoView->setPlainText(i18n("Requesting User Profile, please wait...")); } QTimer::singleShot(0, this, SLOT(slotUpdateProfile())); } }
void WMessageBox::setEscapeButton(StandardButton button) { WPushButton *b = this->button(button); if (b) setEscapeButton(b); }
AIMUserInfoDialog::AIMUserInfoDialog( Kopete::Contact *c, AIMAccount *acc, bool modal, QWidget *parent, const char* name ) : KDialogBase( parent, name, modal, i18n( "User Information on %1" ) .arg( c->property( Kopete::Global::Properties::self()->nickName() ).value().toString() ), Cancel | Ok , Ok, true ) { kdDebug(14200) << k_funcinfo << "for contact '" << c->contactId() << "'" << endl; m_contact = c; mAccount = acc; mMainWidget = new AIMUserInfoWidget(this, "aimuserinfowidget"); setMainWidget(mMainWidget); QObject::connect(this, SIGNAL(okClicked()), this, SLOT(slotSaveClicked())); QObject::connect(this, SIGNAL(user1Clicked()), this, SLOT(slotUpdateClicked())); QObject::connect(this, SIGNAL(cancelClicked()), this, SLOT(slotCloseClicked())); QObject::connect(c, SIGNAL(updatedProfile()), this, SLOT(slotUpdateProfile())); mMainWidget->txtScreenName->setText( c->contactId() ); QString nickName = c->property( Kopete::Global::Properties::self()->nickName() ).value().toString(); if( nickName.isEmpty() ) mMainWidget->txtNickName->setText( c->contactId() ); else mMainWidget->txtNickName->setText( nickName ); if(m_contact == mAccount->myself()) // edit own account profile { mMainWidget->lblWarnLevel->hide(); mMainWidget->txtWarnLevel->hide(); mMainWidget->lblIdleTime->hide(); mMainWidget->txtIdleTime->hide(); mMainWidget->lblOnlineSince->hide(); mMainWidget->txtOnlineSince->hide(); mMainWidget->txtAwayMessage->hide(); mMainWidget->lblAwayMessage->hide(); userInfoView=0L; mMainWidget->userInfoFrame->setFrameStyle(QFrame::NoFrame | QFrame::Plain); QVBoxLayout *l = new QVBoxLayout(mMainWidget->userInfoFrame); userInfoEdit = new KTextEdit(QString::null, QString::null, mMainWidget->userInfoFrame, "userInfoEdit"); userInfoEdit->setTextFormat(PlainText); AIMMyselfContact* aimmc = dynamic_cast<AIMMyselfContact*>( c ); if ( aimmc ) userInfoEdit->setText( aimmc->userProfile() ); else userInfoEdit->setText( QString::null ); setButtonText(Ok, i18n("&Save Profile")); showButton(User1, false); l->addWidget(userInfoEdit); } else { userInfoEdit=0L; mMainWidget->userInfoFrame->setFrameStyle(QFrame::NoFrame | QFrame::Plain); QVBoxLayout *l = new QVBoxLayout(mMainWidget->userInfoFrame); userInfoView = new KTextBrowser(mMainWidget->userInfoFrame, "userInfoView"); userInfoView->setTextFormat(AutoText); userInfoView->setNotifyClick(true); QObject::connect( userInfoView, SIGNAL(urlClick(const QString&)), this, SLOT(slotUrlClicked(const QString&))); QObject::connect( userInfoView, SIGNAL(mailClick(const QString&, const QString&)), this, SLOT(slotMailClicked(const QString&, const QString&))); showButton(Cancel, false); setButtonText(Ok, i18n("&Close")); setEscapeButton(Ok); l->addWidget(userInfoView); if(m_contact->isOnline()) { // Update the user view to indicate that we're requesting the user's profile userInfoView->setText(i18n("Requesting User Profile, please wait...")); } QTimer::singleShot(0, this, SLOT(slotUpdateProfile())); } }