示例#1
0
/*!
  \internal
  \fn void PhoneLauncherView::selectionChangedHandler(GridItem *item)
  Called in response to the current item changing (i.e. SelectedItem has shifted position,
  highlight a different GridItem object). Updates the window title, and emits the
  signal highlighted(...).
  Signals emitted: \l{function}{highlighted(QContent)}.
*/
void PhoneLauncherView::selectionChangedHandler(GridItem *item)
{
    if ( !item ) {
        qWarning("PhoneLauncherView::selectionChangedHandler(...): Error - item parameter is null.");
        // Set the title to a space rather than an empty string. This causes the title bar to
        // remain the same, but just without a title. An empty string will cause a different kind of
        // title bar to appear.
        if (!Qtopia::mousePreferred())
            topLevelWidget()->setWindowTitle(" ");
        return;
    }

    if ( !(item->content()) ) {
        // Set the title to a space rather than an empty string. This causes the title bar to
        // remain the same, but just without a title. An empty string will cause a different kind of
        // title bar to appear.
        if (!Qtopia::mousePreferred())
            topLevelWidget()->setWindowTitle(" ");
        return;
    }

    emit highlighted(*(item->content()));
    if (!Qtopia::mousePreferred())
        topLevelWidget()->setWindowTitle(item->content()->name());
}
示例#2
0
void BasicTab::slotCapturedShortcut(const TDEShortcut& cut)
{
    if (signalsBlocked())
       return;

    if( KKeyChooser::checkGlobalShortcutsConflict( cut, true, topLevelWidget())
        || KKeyChooser::checkStandardShortcutsConflict( cut, true, topLevelWidget()))
        return;

    if ( KHotKeys::present() )
    {
       if (!_menuEntryInfo->isShortcutAvailable( cut ) )
       {
          KService::Ptr service;
          emit findServiceShortcut(cut, service);
          if (!service)
             service = KHotKeys::findMenuEntry(cut.toString());
          if (service)
          {
             KMessageBox::sorry(this, i18n("<qt>The key <b>%1</b> can not be used here because it is already used to activate <b>%2</b>.").arg(cut.toString(), service->name()));
             return;
          }
          else
          {
             KMessageBox::sorry(this, i18n("<qt>The key <b>%1</b> can not be used here because it is already in use.").arg(cut.toString()));
             return;
          }
       }
       _menuEntryInfo->setShortcut( cut );
    }
    _keyEdit->setShortcut(cut, false);
    if (_menuEntryInfo)
       emit changed( _menuEntryInfo );
}
示例#3
0
void UserWnd::setMessage(Message *&msg)
{
    bool bSetFocus = false;

	Container *container = NULL;
    if (topLevelWidget() && topLevelWidget()->inherits("Container")){
        container = static_cast<Container*>(topLevelWidget());
        if (container->wnd() == this)
            bSetFocus = true;
    }

    data.MessageType = msg->type();
    if (!m_edit->setMessage(msg, bSetFocus)){
		delete msg;
		msg = new Message(MessageGeneric);
		m_edit->setMessage(msg, bSetFocus);
	}
	if (container){
		container->setMessageType(msg->type());
		container->contactChanged(getContacts()->contact(m_id));
	}

    if ((m_view == NULL) || (msg->id() == 0))
        return;
    if (m_view->findMessage(msg))
        return;
    m_view->addMessage(msg);
}
示例#4
0
文件: popup.cpp 项目: cwarden/quasar
Popup::Popup(QWidget* text, QButton* button, QWidget* parent, const char* name)
    : QWidget(parent, name)
{
    _text = text;
    _button = button;
    _popup = NULL;

    text->reparent(this, 0, QPoint());
    if (text->inherits("LineEdit"))
	connect(text, SIGNAL(validData()), SIGNAL(validData()));

    button->reparent(this, 0, QPoint());
    connect(button, SIGNAL(clicked()), SLOT(openPopup()));

    if (topLevelWidget())
	topLevelWidget()->installEventFilter(this);
    text->installEventFilter(this);

    setFocusProxy(text);
    setFocusPolicy(StrongFocus);

    QGridLayout* grid = new QGridLayout(this);
    grid->setColStretch(0, 1);
    grid->addWidget(text, 0, 0);
    grid->addWidget(button, 0, 1, AlignLeft | AlignVCenter);

    setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
}
示例#5
0
void UserWnd::setMessage(Message **msg)
{
    bool bSetFocus = false;

    Container *container = NULL;
    if (topLevelWidget() && topLevelWidget()->inherits("Container")){
        container = static_cast<Container*>(topLevelWidget());
        if (container->wnd() == this)
            bSetFocus = true;
    }
    if (!m_edit->setMessage(*msg, bSetFocus)){
        delete *msg;
        *msg = new Message(MessageGeneric);
        m_edit->setMessage(*msg, bSetFocus);
    }
    if (container){
        container->setMessageType((*msg)->baseType());
        container->contactChanged(getContacts()->contact(m_id));
    }

    if ((m_view == NULL) || ((*msg)->id() == 0))
        return;
    if (m_view->findMessage(*msg))
        return;
    m_view->addMessage(*msg);
    if (!m_view->hasSelectedText())
        m_view->scrollToBottom();
}
示例#6
0
void FontEdit::chooseFont()
{
#ifdef USE_KDE
    QFont _f = f;
    if (KFontDialog::getFont(_f, false, topLevelWidget()) == KFontDialog::Accepted)
        setWinFont(_f);
#else
    bool ok = false;
    QFont _f = QFontDialog::getFont(&ok, f, topLevelWidget());
    if (ok) setWinFont(_f);
#endif
}
示例#7
0
QSize TransactionItemView::minimumSizeHint() const
{
  int f = 2 * frameWidth();
  // Make room for a vertical scrollbar in all cases, to avoid a horizontal one
  int vsbExt = verticalScrollBar()->sizeHint().width();
  int minw = topLevelWidget()->width() / 3;
  int maxh = topLevelWidget()->height() / 2;
  QSize sz( mBigBox->minimumSizeHint() );
  sz.setWidth( QMAX( sz.width(), minw ) + f + vsbExt );
  sz.setHeight( QMIN( sz.height(), maxh ) + f );
  return sz;
}
示例#8
0
void MsgEdit::setFont()
{
    if ((msg == NULL) || (msg->Type() != ICQ_MSGxMSG)) return;
#ifdef USE_KDE
    QFont f = edit->font();
    if (KFontDialog::getFont(f, false, topLevelWidget()) == KFontDialog::Accepted)
        edit->setCurrentFont(f);
#else
    bool ok = false;
    QFont f = QFontDialog::getFont(&ok, edit->font(), topLevelWidget());
    if (ok) edit->setCurrentFont(f);
#endif
}
示例#9
0
void TB_TeamBody::advancedClicked(int index, bool separateWindow)
{
    if(!dockAdvanced())
    {
        createDockAdvanced(separateWindow);
        dockAdvanced()->setCurrentPokemon(index);
    } else {
        int width = m_dockAdvanced->width();
        m_dockAdvanced->close();
        if (!advSepWindow)
            topLevelWidget()->resize(topLevelWidget()->width()- width, topLevelWidget()->height());
    }
}
示例#10
0
void MsgEdit::messageReceived(ICQMessage *m)
{
    if (m->getUin() != Uin()) return;
    setupNext();
    if (msg && msg->Received && (static_cast<UserBox*>(topLevelWidget())->currentUser() == Uin)) return;
    if (canSend()) return;
    ICQMessage *msg_copy = history()->getMessage(m->Id);
    setMessage(msg_copy, false, true);
    if (qApp->activeWindow() != topLevelWidget()) return;
    if (static_cast<UserBox*>(topLevelWidget())->currentUser() != Uin) return;
    pClient->markAsRead(m);
    setupNext();
}
示例#11
0
/*!
  \internal
  \fn void PhoneLauncherView::focusInEvent(QFocusEvent *event)
  Ensures that when the PhoneLauncherView is focused after an activity such as launching an
  application, the current icon will animate.
*/
void PhoneLauncherView::focusInEvent(QFocusEvent *event)
{
    QGraphicsView::focusInEvent(event);

    if ( selectedItem && event->reason() != Qt::PopupFocusReason && !Qtopia::mousePreferred()) {
        selectedItem->startAnimating();
    }

    if (Qtopia::mousePreferred())
        topLevelWidget()->setWindowTitle(tr("Main Menu"));
    else if (currentItem())
        topLevelWidget()->setWindowTitle(currentGridItem()->content()->name());
}
示例#12
0
bool SidebarExtension::eventFilter( TQObject *, TQEvent *e ) {
	if (e->type()==TQEvent::MouseButtonPress) {
		m_resizing=true;
		m_x=((TQMouseEvent*)e)->globalX();
		return true;
	} else if (e->type()==TQEvent::MouseButtonRelease) {
		m_resizing=false;
		m_expandedSize=topLevelWidget()->width();
		needLayoutUpdate(true);
		return true;
	} else if (e->type()==TQEvent::MouseMove) {
		if (m_resizing) {
			Position p=position();
			if (p==Left) {
				int diff=((TQMouseEvent*)e)->globalX()-m_x;
					if (abs(diff)>3) {
						topLevelWidget()->setFixedWidth(topLevelWidget()->width()+diff);
						m_x=((TQMouseEvent*)e)->globalX();
					}
			} else if (p==Right) {
				int diff=((TQMouseEvent*)e)->globalX()-m_x;
					if (abs(diff)>3) {
						topLevelWidget()->setFixedWidth(topLevelWidget()->width()-diff);
						topLevelWidget()->move(topLevelWidget()->x()+diff,topLevelWidget()->y());
						m_x=((TQMouseEvent*)e)->globalX();
					}
			}
			return true;
		}
	}
	return false;
}
示例#13
0
void RichTextEdit::selectFont()
{
#ifdef USE_KDE
    QFont f = m_edit->font();
    if (KFontDialog::getFont(f, false, topLevelWidget()) != KFontDialog::Accepted)
        return;
#else
    bool ok = false;
    QFont f = QFontDialog::getFont(&ok, m_edit->font(), topLevelWidget());
    if (!ok)
        return;
#endif
    m_edit->setCurrentFont(f);
}
示例#14
0
void QWidget::setActiveWindow()
{
    QWidget *tlw = topLevelWidget();
    if ( tlw->isVisible() ) {
	qwsDisplay()->requestFocus( tlw->winId(), TRUE);
    }
}
示例#15
0
void QWidget::showWindow()
{
    if ( testWFlags(WType_TopLevel) ) {
	updateRequestedRegion( mapToGlobal(QPoint(0,0)) );
	QRegion r( req_region );
#ifndef QT_NO_QWS_MANAGER
	if ( extra && extra->topextra && extra->topextra->qwsManager ) {
	    QRegion wmr = extra->topextra->qwsManager->region();
	    wmr = qt_screen->mapToDevice( wmr, QSize(qt_screen->width(), qt_screen->height()) );
	    r += wmr;
	}
#endif
	qwsDisplay()->requestRegion(winId(), r);
	if ( !testWFlags(WStyle_Tool) ) {
	    qwsDisplay()->requestFocus(winId(),TRUE);
	}
	qwsDisplay()->setAltitude( winId(),
		testWFlags(WStyle_StaysOnTop) ? 1 : 0, TRUE );

    } else if ( !topLevelWidget()->in_show ) {
	updateRequestedRegion( mapToGlobal(QPoint(0,0)) );
	QWidget *p = parentWidget();
	p->setChildrenAllocatedDirty( geometry(), this );
	p->paintable_region_dirty = TRUE;
	p->overlapping_children = -1;
	paint_heirarchy( this, TRUE );
    }
}
示例#16
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);
}
示例#17
0
YahooResult::YahooResult(QWidget *parent, YahooClient *client)
        : YahooResultBase(parent)
{
    m_client = client;
    m_wizard = static_cast<QWizard*>(topLevelWidget());
    m_wizard->setFinishEnabled(this, true);
}
示例#18
0
/*!
    Constructs a resize corner called \a name, as a child widget of \a
    parent.
*/
QSizeGrip::QSizeGrip( QWidget * parent, const char* name )
    : QWidget( parent, name )
{
#ifndef QT_NO_CURSOR
#ifndef Q_WS_MAC
    if ( QApplication::reverseLayout() )
	setCursor( sizeBDiagCursor );
    else
	setCursor( sizeFDiagCursor );
#endif
#endif
    setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Fixed ) );
#if defined(Q_WS_X11)
    if ( !qt_sizegrip_workspace( this ) ) {
	WId id = winId();
	XChangeProperty(qt_xdisplay(), topLevelWidget()->winId(),
			qt_sizegrip, XA_WINDOW, 32, PropModeReplace,
			(unsigned char *)&id, 1);
    }
#endif
    tlw = qt_sizegrip_topLevelWidget( this );
    if ( tlw )
	tlw->installEventFilter( this );
    installEventFilter( this ); //for binary compatibility fix in 4.0 with an event() ###
}
示例#19
0
/*!
  Different from QWidget::isActiveWindow()
 */
bool KXtWidget::isActiveWindow() const
{
    Window win;
    int revert;
    XGetInputFocus( qt_xdisplay(), &win, &revert );

    if ( win == None) return FALSE;

    QWidget *w = find( (WId)win );
    if ( w ) {
        // We know that window
        return w->topLevelWidget() == topLevelWidget();
    } else {
        // Window still may be a parent (if top-level is foreign window)
        Window root, parent;
        Window cursor = winId();
        Window *ch;
        unsigned int nch;
        while ( XQueryTree(qt_xdisplay(), cursor, &root, &parent, &ch, &nch) ) {
            if (ch) XFree( (char*)ch);
            if ( parent == win ) return TRUE;
            if ( parent == root ) return FALSE;
            cursor = parent;
        }
        return FALSE;
    }
}
示例#20
0
void RadioGroup::slotToggled()
{
    if (!m_bInit){
        QPushButton *btnDefault = NULL;
        QObjectList *l = topLevelWidget()->queryList("QPushButton");
        QObjectListIt it(*l);
        QObject *obj;
        while ((obj=it.current()) != NULL){
            btnDefault = static_cast<QPushButton*>(obj);
            if (btnDefault->isDefault())
                break;
            btnDefault = NULL;
            ++it;
        }
        delete l;
        if (btnDefault){
            m_bInit = true;
            QObjectList *l = parentWidget()->queryList("QLineEdit");
            QObjectListIt it(*l);
            QObject *obj;
            while ((obj=it.current()) != NULL){
                connect(obj, SIGNAL(returnPressed()), btnDefault, SLOT(animateClick()));
                ++it;
            }
            delete l;
        }
    }
    slotToggled(m_button->isChecked());
}
示例#21
0
//-----------------------------------------------------------------------------
int ctkMenuButtonTest1(int argc, char * argv [] )
{
  QApplication app(argc, argv);

  QWidget topLevelWidget(0);
  QMenu* menu = new QMenu("menu");
  menu->addAction("extra choice 1");
  menu->addAction("extra choice 2");
  menu->addAction("extra choice 3");

  QPushButton button1("QPushButton with no menu");
  QPushButton button2("QPushButton with menu");
  button2.setMenu(menu);  
  ctkMenuButton button3("ctkMenuButton with no menu");
  ctkMenuButton button4("ctkMenuButton with menu");  
  button4.setMenu(menu);
  
  QVBoxLayout* layout = new QVBoxLayout;
  layout->addWidget(&button1);
  layout->addWidget(&button2);
  layout->addWidget(&button3);
  layout->addWidget(&button4);
  
  topLevelWidget.setLayout(layout);
  topLevelWidget.show();
  topLevelWidget.resize(200, 100);

  if (argc < 2 || QString(argv[1]) != "-I" )
    {
    QTimer::singleShot(200, &app, SLOT(quit()));
    }

  return app.exec();
}
示例#22
0
void ICQSearchResult::setText(const QString &text)
{
    lblStatus->setText(text);
    tblUser->hide();
    QWizard *wizard = static_cast<QWizard*>(topLevelWidget());
    wizard->setFinishEnabled(this, true);
}
//--------------------------------------------------------------------------------
void QmvQueryWidget::advancedQuery()
{
    static QmvQueryWidget * aq;
    if ( !dialog_advqry )
    {
        aq = new QmvQueryWidget( this, this, "advanced query" );
        dialog_advqry = aq->getAdvancedDialog();
        dialog_advqry->move( mapToGlobal( QPoint( topLevelWidget()->width() - 400, 0) ) );
    }
        // update adv from simple
    aq->getCondition(0)->update();
        // activate all conditions
    for ( int row = 0; row < query_object->countConditions(); row++ )
        query_object->getCondition( row )->setActive(TRUE);

        // Run the advanced query
    dialog_advqry->exec();
    
        // update simple from adv
    getCondition(0)->update();
        // deactivate all other than first condition
    for ( int row = 1; row < query_object->countConditions(); row++ )
        query_object->getCondition( row )->setActive(FALSE);
    
}
示例#24
0
bool MsgEdit::canSend()
{
    if (msg){
        if (bMultiply){
            UserBox *box = static_cast<UserBox*>(topLevelWidget());
            if (box->users == NULL) return false;
            UserView *users = box->users;
            if (!users->hasChecked()) return false;
        }
        switch (msg->Type()){
        case ICQ_MSGxMSG:
            return (edit->length());
        case ICQ_MSGxURL:
            return (urlEdit->text().length());
        case ICQ_MSGxFILE:
            return (fileEdit->text().length());
        case ICQ_MSGxSMS:
            return (edit->length() && phoneEdit->lineEdit()->text().length());
        case ICQ_MSGxCONTACTxLIST:
            return (!users->isEmpty());
        case ICQ_MSGxCHAT:
        case ICQ_MSGxAUTHxREFUSED:
        case ICQ_MSGxAUTHxGRANTED:
        case ICQ_MSGxAUTHxREQUEST:
            return true;
        }
    }
    return false;
}
QvisScatterPlotWizard::QvisScatterPlotWizard(AttributeSubject *s,
                                             QWidget *parent,
                                             const std::string &var_name)
: QvisWizard(s, parent)
{

    setOption(QWizard::NoCancelButton, false);
    setOption(QWizard::HaveHelpButton, false);
    setOption(QWizard::HaveNextButtonOnLastPage, false);
    setOption(QWizard::NoBackButtonOnLastPage, true);

    // Set some defaults into the wizard's local copy of the plot attributes.
    scatterAtts->SetVar1Role(ScatterAttributes::Coordinate0);
    scatterAtts->SetVar2("default");
    scatterAtts->SetVar2Role(ScatterAttributes::Coordinate1);
    scatterAtts->SetVar3("default");
    scatterAtts->SetVar3Role(ScatterAttributes::Coordinate2);
    scatterAtts->SetVar4("default");
    scatterAtts->SetVar4Role(ScatterAttributes::Color);

    // Set the wizard's title.
    topLevelWidget()->setWindowTitle(tr("Scatter Plot Setup"));

    //
    // Create the main wizard page.
    //
    mainPage = new QvisScatterPlotWizardPage(s,this,var_name);
    addPage(mainPage);
    mainPage->setFinalPage(true);
}
示例#26
0
void GeneralSettings::slotOpenAccountWizard()
{
    if (QSystemTrayIcon::isSystemTrayAvailable()) {
        topLevelWidget()->close();
    }
    OwncloudSetupWizard::runWizard(qApp, SLOT(slotownCloudWizardDone(int)), 0);
}
示例#27
0
void ICQSearchResult::setRequestId(unsigned short id)
{
    m_id = id;
    setStatus();
    QWizard *wizard = static_cast<QWizard*>(topLevelWidget());
    wizard->setFinishEnabled(this, (m_id == 0) || (m_id == SEARCH_FAIL));
}
示例#28
0
void ICQSearchResult::clear()
{
    setRequestId(SEARCH_DONE, SEARCH_DONE);
    m_nFound = 0;
    tblUser->clear();
    QWizard *wizard = static_cast<QWizard*>(topLevelWidget());
    wizard->setFinishEnabled(this, false);
}
示例#29
0
void OverlayWidget::reposition()
{
    if ( !mAlignWidget )
        return;

    // p is in the alignWidget's coordinates
    QPoint p;
    // We are always above the alignWidget, right-aligned with it.
    p.setX(mAlignWidget->width() - width());
    p.setY(-height());
    // Position in the toplevelwidget's coordinates
    QPoint pTopLevel = mAlignWidget->mapTo(topLevelWidget(), p);
    // Position in the widget's parentWidget coordinates
    QPoint pParent   = parentWidget()->mapFrom(topLevelWidget(), pTopLevel);
    // Move 'this' to that position.
    move(pParent);
}
示例#30
0
void MenuConfig::add()
{
    AddItem add(topLevelWidget());
    if (add.exec()) {
        new QListViewItem(lstMenu, add.edtItem->text(), add.edtPrg->text());
        lstMenu->adjustColumn();
    }
}