コード例 #1
0
ProxyWidget *DockContainer::loadModule(ConfigModule *module)
{
    QApplication::setOverrideCursor(waitCursor);

    ProxyWidget *widget = _modulew->load(module);

    if(widget)
    {
        _module = module;
        connect(_module, SIGNAL(childClosed()), SLOT(removeModule()));
        connect(_module, SIGNAL(changed(ConfigModule *)), SIGNAL(changedModule(ConfigModule *)));
        connect(widget, SIGNAL(quickHelpChanged()), SLOT(quickHelpChanged()));

        raiseWidget(_modulew);
        emit newModule(widget->caption(), module->docPath(), widget->quickHelp());
    }
    else
    {
        raiseWidget(_basew);
        emit newModule(_basew->caption(), "", "");
    }

    QApplication::restoreOverrideCursor();

    return widget;
}
コード例 #2
0
bool QWidgetStack::qt_invoke( int _id, QUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: raiseWidget((int)static_QUType_int.get(_o+1)); break;
    case 1: raiseWidget((QWidget*)static_QUType_ptr.get(_o+1)); break;
    default:
	return QFrame::qt_invoke( _id, _o );
    }
    return TRUE;
}
コード例 #3
0
/* FUNCTION: publish */
void LogHandlerWidget::publish(LogRecord logRecord) {
	if (logRecord.getLogLevel() >= logLevel) {
		//mutex.lock();
		QString color = "";
		QString bgcolor = "";
		if (logRecord.getLogLevel() == 3)
			bgcolor = "yellow";
		if (logRecord.getLogLevel() == 4) {
			bgcolor = "orange";
		}
		QString level =
			QString("%1").arg(LogLevelNames[logRecord.getLogLevel()], 7);
		level.replace(QString(" "), QString(" "));
		QString source =
			logRecord.getSource().length() == 0 ?
				"" : logRecord.getSource().append(": ").c_str();
		QString message =
			QString("<table border=0 cellspacing=0 cellpadding=0><tr><td><font color=grey>%1 </font></td><td bgcolor=%2><font type=courier color=%3>[<code>%4</code>] </font></td><td bgcolor=%2><font color=%3>%5 %6</font></td></tr></table>")
				.arg(logRecord.getDateTime()
					.toString("yyyy-MM-dd hh:mm:ss.zzz"))
				.arg(bgcolor).arg(color)
				.arg(level)
				.arg(source)
				.arg(logRecord.getMessage().c_str());
		textEdit->insertHtml(message);
		textEdit->ensureCursorVisible();

		if (logRecord.getLogLevel() > 2)
			emit raiseWidget();
		
		//mutex.unlock();
	}
}
コード例 #4
0
ファイル: owidgetstack.cpp プロジェクト: opieproject/opie
/**
 * This is overloaded and only differs in the parameters
 * it takes.
 */
void OWidgetStack::hideWidget( QWidget* wid) {
    /* still not smart */
    if ( m_mode == BigScreen && m_last != m_mWidget )
        m_last->hide();

    raiseWidget( wid );
}
コード例 #5
0
bool DockContainer::dockModule(ConfigModule *module)
{
    if(module == _module)
        return true;

    if(_module && _module->isChanged())
    {

        int res = KMessageBox::warningYesNoCancel(this, module ? i18n("There are unsaved changes in the active module.\n"
                                                                      "Do you want to apply the changes before running "
                                                                      "the new module or discard the changes?")
                                                               : i18n("There are unsaved changes in the active module.\n"
                                                                      "Do you want to apply the changes before exiting "
                                                                      "the Control Center or discard the changes?"),
                                                  i18n("Unsaved Changes"), KStdGuiItem::apply(), KStdGuiItem::discard());
        if(res == KMessageBox::Yes)
            _module->module()->applyClicked();
        if(res == KMessageBox::Cancel)
            return false;
    }

    raiseWidget(_busyw);
    kapp->processEvents();

    deleteModule();
    if(!module)
        return true;

    ProxyWidget *widget = loadModule(module);

    KCGlobal::repairAccels(topLevelWidget());
    return (widget != 0);
}
コード例 #6
0
ファイル: qwidgetstack.cpp プロジェクト: aroraujjwal/qt3
void QWidgetStack::raiseWidget( int id )
{
    if ( id == -1 )
	return;
    QWidget * w = dict->find( id );
    if ( w )
	raiseWidget( w );
}
コード例 #7
0
Preview::Preview(QWidget *parent) : QWidgetStack(parent)
{
    normalText = new QMultiLineEdit(this);
    normalText->setReadOnly(true);
    html = new QTextView(this);
    pixmap = new PixmapView(this);
    raiseWidget(normalText);
}
コード例 #8
0
void DockContainer::removeModule()
{
    raiseWidget(_basew);
    deleteModule();

    if(_basew)
        emit newModule(_basew->caption(), "", "");
    else
        emit newModule("", "", "");
}
コード例 #9
0
bool SetupDialog::raiseWidget(QListViewItem *i, unsigned id)
{
    if (id == i->text(1).toULong()){
        lstBars->setCurrentItem(i);
        return true;
    }
    for (QListViewItem *item = i->firstChild(); item != NULL; item = item->nextSibling())
        if (raiseWidget(item, id)) return true;
    return false;
}
コード例 #10
0
void DockContainer::setBaseWidget(QWidget *widget)
{
  removeWidget( _basew );
  delete _basew;
  _basew = 0;
  if (!widget) return;

  _basew = widget;

  addWidget( _basew );
  raiseWidget( _basew );

  emit newModule(widget->caption(), "", "");
}
コード例 #11
0
void StackedConfigurationGroup::raise(Configurable* child)
{
    for (uint i = 0 ; i < children.size() ; i++)
    {
        if (children[i] == child)
        {
            top = i;
            emit raiseWidget((int)i);
            return;
        }
    }

    VERBOSE(VB_IMPORTANT, "BUG: StackedConfigurationGroup::raise(): "
            "unrecognized child " << child << " "
            <<QString("on setting %1/%2").arg(getName()).arg(getLabel()));
}
コード例 #12
0
void Preview::showPreview(const QString &str)
{
    QUrl u(str);
    if(u.isLocalFile())
    {
        QString path = u.path();
        QFileInfo fi(path);
        if(fi.isFile() && (int)fi.size() > 400 * 1024)
        {
            normalText->setText(tr("The File\n%1\nis too large, so I don't show it!").arg(path));
            raiseWidget(normalText);
            return;
        }

        QPixmap pix(path);
        if(pix.isNull())
        {
            if(fi.isFile())
            {
                QFile f(path);
                if(f.open(IO_ReadOnly))
                {
                    QTextStream ts(&f);
                    QString text = ts.read();
                    f.close();
                    if(fi.extension().lower().contains("htm"))
                    {
                        QString url = html->mimeSourceFactory()->makeAbsolute(path, html->context());
                        html->setText(text, url);
                        raiseWidget(html);
                        return;
                    }
                    else
                    {
                        normalText->setText(text);
                        raiseWidget(normalText);
                        return;
                    }
                }
            }
            normalText->setText(QString::null);
            raiseWidget(normalText);
        }
        else
        {
            pixmap->setPixmap(pix);
            raiseWidget(pixmap);
        }
    }
    else
    {
        normalText->setText("I only show local files!");
        raiseWidget(normalText);
    }
}
コード例 #13
0
ファイル: knotification.cpp プロジェクト: KDE/knotifications
void KNotification::Private::raiseWidget(QWidget *w)
{
    //TODO  this function is far from finished.
    if (w->isTopLevel()) {
        w->raise();
#if defined(Q_OS_MAC)
        w->activateWindow();
#else
        KWindowSystem::activateWindow(w->winId());
#endif
    } else {
        QWidget *pw = w->parentWidget();
        raiseWidget(pw);

        if (QTabWidget *tab_widget = qobject_cast<QTabWidget *>(pw)) {
            tab_widget->setCurrentIndex(tab_widget->indexOf(w));
        }
    }
}
コード例 #14
0
ファイル: owidgetstack.cpp プロジェクト: opieproject/opie
/**
 * This will hide the currently visible widget
 * and raise the widget specified by the parameter.
 * Note that this method does not use visibleWIdget but remembers
 * the last raisedWidget
 */
void OWidgetStack::hideWidget( int id) {
    /* hiding our main widget wouldn't be smart */
    if ( m_mode == BigScreen && m_last != m_mWidget )
        m_last->hide();
    raiseWidget( id );
}
コード例 #15
0
ファイル: owidgetstack.cpp プロジェクト: opieproject/opie
/**
 * This method raises the widget wit the specefic id.
 * Note that in BigScreen mode the widget is made visible
 * but the other ( previous) visible widget(s) will not
 * be made invisible. If you need this use hideWidget().
 *
 * @param id Raise the widget with id
 */
void OWidgetStack::raiseWidget( int id) {
    return raiseWidget( widget( id ) );
}
コード例 #16
0
UserInfo::UserInfo(unsigned long uin, unsigned short grpId, int page)
        : UserInfoBase(NULL, "userinfo", WType_TopLevel | WStyle_Dialog| WDestructiveClose)
{
    SET_WNDPROC("userinfo")

    inSave = false;
    setButtonsPict(this);

    m_nUin   = uin;
    m_nGrpId = grpId;

    ICQUser *u = NULL;
    if (uin){
        u = pClient->getUser(uin);
        if (u == NULL) return;
    }
    ICQGroup *g = NULL;
    if (grpId){
        g = pClient->getGroup(grpId);
        if (g == NULL) return;
    }

    lstBars->clear();
    lstBars->header()->hide();
    lstBars->setSorting(1);
    connect(lstBars, SIGNAL(selectionChanged()), this, SLOT(selectionChanged()));

    itemMain = new QListViewItem(lstBars, i18n("User info"), QString::number(SETUP_DETAILS));
    itemMain->setOpen(true);

    if (u){
        addWidget(p_MainInfo, SETUP_MAININFO, i18n("Main info"), "main");
        if (u->Type == USER_TYPE_ICQ){
            addWidget(p_HomeInfo, SETUP_HOMEINFO, i18n("Home info"), "home");
            addWidget(p_WorkInfo, SETUP_WORKINFO, i18n("Work info"), "work");
            addWidget(p_MoreInfo, SETUP_MOREINFO, i18n("More info"), "more");
            addWidget(p_AboutInfo, SETUP_ABOUT, i18n("About info"), "info");
            addWidget(p_InterestsInfo, SETUP_INTERESTS, i18n("Interests"), "interest");
            addWidget(p_PastInfo, SETUP_PAST, i18n("Group/Past"), "past");
        }
        addWidget(p_PhoneBookDlg, SETUP_PHONE, i18n("Phone book"), "phone");
    }

    if ((uin == 0) || (u->Type == USER_TYPE_ICQ)){
        itemMain = new QListViewItem(lstBars, i18n("Preferences"), QString::number(SETUP_PREFERENCES));
        itemMain->setOpen(true);
        addWidget(p_AlertDialog, SETUP_ALERT, i18n("Alert"), "alert");
        addWidget(p_AcceptDialog, SETUP_ACCEPT, i18n("Accept"), "message");
        addWidget(p_SoundSetup, SETUP_SOUND, i18n("Sound"), "sound");
    }
    if (g || (u && (u->Type == USER_TYPE_ICQ))){
        itemMain = new QListViewItem(lstBars, i18n("Auto reply"), QString::number(SETUP_AUTOREPLY));
        itemMain->setOpen(true);
        addWidget(p_MsgDialog, SETUP_AR_AWAY,
                  SIMClient::getStatusText(ICQ_STATUS_AWAY), SIMClient::getStatusIcon(ICQ_STATUS_AWAY),
                  ICQ_STATUS_AWAY);
        addWidget(p_MsgDialog, SETUP_AR_NA,
                  SIMClient::getStatusText(ICQ_STATUS_NA), SIMClient::getStatusIcon(ICQ_STATUS_NA),
                  ICQ_STATUS_NA);
        addWidget(p_MsgDialog, SETUP_AR_OCCUPIED,
                  SIMClient::getStatusText(ICQ_STATUS_OCCUPIED), SIMClient::getStatusIcon(ICQ_STATUS_OCCUPIED),
                  ICQ_STATUS_OCCUPIED);
        addWidget(p_MsgDialog, SETUP_AR_DND,
                  SIMClient::getStatusText(ICQ_STATUS_DND), SIMClient::getStatusIcon(ICQ_STATUS_DND),
                  ICQ_STATUS_DND);
        addWidget(p_MsgDialog, SETUP_AR_FREEFORCHAT,
                  SIMClient::getStatusText(ICQ_STATUS_FREEFORCHAT), SIMClient::getStatusIcon(ICQ_STATUS_FREEFORCHAT),
                  ICQ_STATUS_FREEFORCHAT);
    }
    raiseWidget(page ? page : (u ? SETUP_MAININFO : SETUP_ALERT));

    connect(pClient, SIGNAL(event(ICQEvent*)), this, SLOT(processEvent(ICQEvent*)));
    connect(btnSave, SIGNAL(clicked()), this, SLOT(saveInfo()));
    connect(btnClose, SIGNAL(clicked()), this, SLOT(close()));
    if (u && (u->Type == USER_TYPE_ICQ)){
        connect(btnUpdate, SIGNAL(clicked()), this, SLOT(update()));
    }else{
        btnUpdate->hide();
    }
    loadInfo();
    setTitle();
    setIcon();
}
コード例 #17
0
SetupDialog::SetupDialog(QWidget*, int nWin)
        : SetupDialogBase(NULL, "setup", false, WStyle_Minimize )
{
    SET_WNDPROC

    setButtonsPict(this);

    new TransparentTop(this, pMain->UseTransparentContainer, pMain->TransparentContainer);

    setIcon(Pict("configure"));
    setCaption(i18n("Setup"));

    connect(btnUpdate, SIGNAL(clicked()), this, SLOT(update()));
    connect(btnClose, SIGNAL(clicked()), this, SLOT(close()));
    connect(btnOK, SIGNAL(clicked()), this, SLOT(ok()));
    connect(btnApply, SIGNAL(clicked()), this, SLOT(apply()));
    lstBars->clear();
    lstBars->header()->hide();
    lstBars->setSorting(1);
    connect(lstBars, SIGNAL(selectionChanged()), this, SLOT(selectionChanged()));

    itemMain = new QListViewItem(lstBars, i18n("My details"), QString::number(SETUP_DETAILS));
    itemMain->setOpen(true);

    addPage(p_MainInfo, SETUP_MAININFO, i18n("Main info"), "main");
    addPage(p_HomeInfo, SETUP_HOMEINFO, i18n("Home info"), "home");
    addPage(p_WorkInfo, SETUP_WORKINFO, i18n("Work info"), "work");
    addPage(p_MoreInfo, SETUP_MOREINFO, i18n("More info"), "more");
    addPage(p_AboutInfo, SETUP_ABOUT, i18n("About info"), "info");
    addPage(p_InterestsInfo, SETUP_INTERESTS, i18n("Interests"), "interest");
    addPage(p_PastInfo, SETUP_PAST, i18n("Group/Past"), "past");
    addPage(p_PhoneBookDlg, SETUP_PHONE, i18n("Phone book"), "phone");

    itemMain = new QListViewItem(lstBars, i18n("Preferences"), QString::number(SETUP_PREFERENCES));
    itemMain->setOpen(true);

    addPage(p_StatusSetup, SETUP_STATUS, i18n("Status mode"), "status");
    addPage(p_NetworkSetup, SETUP_CONNECTION, i18n("Connection"), "network");
    addPage(p_ThemeSetup, SETUP_STYLE, i18n("Style"), "style");
    addPage(p_FontSetup, SETUP_INTERFACE, i18n("Interface"), "text");
    addPage(p_KeySetup, SETUP_KEYS, i18n("Key shortcuts"), "key_bindings");
    addPage(p_SoundSetup, SETUP_SOUND, i18n("Sound"), "sound");
    addPage(p_AlertDialog, SETUP_ALERT, i18n("Alert"), "alert");
    addPage(p_AcceptDialog, SETUP_ACCEPT, i18n("Accept"), "message");
    addPage(p_SMSSetup, SETUP_SMS, i18n("SMS"), "sms");

#ifndef WIN32
    addPage(p_MiscSetup, SETUP_MISC, i18n("Miscellaneous"), "misc");
#endif

    itemMain = new QListViewItem(lstBars, i18n("Auto reply"), QString::number(SETUP_AUTOREPLY));
    itemMain->setOpen(true);

    addPage(p_MsgDialog, SETUP_AR_AWAY, SIMClient::getStatusText(ICQ_STATUS_AWAY), "away", ICQ_STATUS_AWAY);
    addPage(p_MsgDialog, SETUP_AR_NA, SIMClient::getStatusText(ICQ_STATUS_NA), "na", ICQ_STATUS_NA);
    addPage(p_MsgDialog, SETUP_AR_OCCUPIED, SIMClient::getStatusText(ICQ_STATUS_OCCUPIED), "occupied", ICQ_STATUS_OCCUPIED);
    addPage(p_MsgDialog, SETUP_AR_DND, SIMClient::getStatusText(ICQ_STATUS_DND), "dnd", ICQ_STATUS_DND);
    addPage(p_MsgDialog, SETUP_AR_FREEFORCHAT, SIMClient::getStatusText(ICQ_STATUS_FREEFORCHAT), "ffc", ICQ_STATUS_FREEFORCHAT);

    itemMain = new QListViewItem(lstBars, i18n("Security"), QString::number(SETUP_SECURITY));
    itemMain->setOpen(true);

    addPage(p_GeneralSecurity, SETUP_GENERAL_SEC, i18n("General"), "webaware");
    addPage(p_IgnoreListSetup, SETUP_IGNORE_LIST, i18n("Ignore list"), "ignorelist");
    addPage(p_InvisibleListSetup, SETUP_INVISIBLE_LIST, i18n("Invisible list"), "invisiblelist");
    addPage(p_VisibleListSetup, SETUP_VISIBLE_LIST, i18n("Visible list"), "visiblelist");

    raiseWidget(nWin ? nWin : SETUP_MAININFO);
    connect(pMain, SIGNAL(iconChanged()), this, SLOT(iconChanged()));

    transparent = new TransparentTop(this, pMain->UseTransparentContainer, pMain->TransparentContainer);
};
コード例 #18
0
void SetupDialog::raiseWidget(int id)
{
    for (QListViewItem *item = lstBars->firstChild(); item != NULL; item = item->nextSibling())
        if (raiseWidget(item, id)) break;
}
コード例 #19
0
void SetupDialog::showPage(int nWin)
{
    raiseWidget(nWin);
}