CommunityWelcomePageWidget::CommunityWelcomePageWidget(QWidget *parent) :
    QWidget(parent),
    m_rssFetcher(new RSSFetcher(7)),
    ui(new Ui::CommunityWelcomePageWidget)
{
    ui->setupUi(this);
    ui->labsTitleLabel->setStyledText(tr("News From the OpenPilot Project"));
    ui->sitesTitleLabel->setStyledText(tr("OpenPilot Websites"));

    connect(ui->newsTreeWidget, SIGNAL(activated(QString)), SLOT(slotUrlClicked(QString)));
    connect(ui->sitesTreeWidget, SIGNAL(activated(QString)), SLOT(slotUrlClicked(QString)));

    connect(m_rssFetcher, SIGNAL(newsItemReady(QString, QString, QString)),
        ui->newsTreeWidget, SLOT(slotAddNewsItem(QString, QString, QString)));
    //: Add localized feed here only if one exists
    m_rssFetcher->fetch(QUrl(tr("http://forums.openpilot.org/blog/rss/4-openpilot-development-blog")));

    QList<QPair<QString, QString> > sites;
    sites << qMakePair(tr("OpenPilot Home"), QString(QLatin1String("http://www.openpilot.org")));
    sites << qMakePair(tr("OpenPilot Wiki"), QString(QLatin1String("http://wiki.openpilot.org")));
    sites << qMakePair(tr("OpenPilot Store"), QString(QLatin1String("http://www.openpilot.org/store")));
    sites << qMakePair(tr("OpenPilot Forums"), QString(QLatin1String("http://forums.openpilot.org")));
    sites << qMakePair(tr("OpenPilot Bug Tracker"), QString(QLatin1String("http://bugs.openpilot.org")));
    
    QListIterator<QPair<QString, QString> > it(sites);
    while (it.hasNext()) {
        QPair<QString, QString> pair = it.next();
        ui->sitesTreeWidget->addItem(pair.first, pair.second, pair.second);
    }

}
Ejemplo n.º 2
0
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()));
	}
}
Ejemplo n.º 3
0
UrlWidget::UrlWidget(QObject *parent)
  : QObject(parent),
    m_resources(0),
    m_countrySort(0),
    m_widget(0)
{
    m_widget = new QWidget;//TODO inherit from qWidget and set this widget as mainwidget?
    ui.setupUi(m_widget);

    m_mirrorModel = new MirrorModel(this);
    m_proxy = new MirrorProxyModel(this);
    m_proxy->setSourceModel(m_mirrorModel);
    ui.used_mirrors->setModel(m_proxy);
    ui.used_mirrors->sortByColumn(MirrorItem::Priority, Qt::DescendingOrder);
    ui.used_mirrors->resizeColumnToContents(MirrorItem::Priority);
    ui.used_mirrors->hideColumn(MirrorItem::Used);
    ui.used_mirrors->hideColumn(MirrorItem::Connections);

    ui.add_mirror->setGuiItem(KStandardGuiItem::add());
    ui.remove_mirror->setGuiItem(KStandardGuiItem::remove());
    ui.remove_mirror->setEnabled(false);
    connect(ui.used_mirrors->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(slotUrlClicked()));
    connect(ui.add_mirror, SIGNAL(clicked(bool)), this, SLOT(slotAddMirror()));
    connect(ui.remove_mirror, SIGNAL(clicked(bool)), this, SLOT(slotRemoveMirror()));
    connect(m_mirrorModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SIGNAL(urlsChanged()));
    connect(m_mirrorModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SIGNAL(urlsChanged()));
    connect(m_mirrorModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SIGNAL(urlsChanged()));
}