bool KHTMLReader::filter(const KUrl& url) { kDebug(30503) << "KHTMLReader::filter"; QObject::connect(_html, SIGNAL(completed()), this, SLOT(completed())); _state.clear(); _list_depth = 0; _html->view()->resize(600, 530); _html->setAutoloadImages(false); _html->setJScriptEnabled(false); _html->setPluginsEnabled(false); _html->setJavaEnabled(false); _html->setMetaRefreshEnabled(false); if (_html->openUrl(url) == false) { kWarning(30503) << "openUrl returned false"; return false; } #ifdef __GNUC__ #warning "kde4: port it" #endif #if 0 //FIXME use synchronous IO instead of this hack if possible. QWidget dummy(0);//,0,WType_Dialog | WShowModal); qt_enter_modal(&dummy); qApp->enter_loop(); qt_leave_modal(&dummy); #endif return _it_worked; }
void KSimpleProcess::enter_loop() { QWidget dummy(0,0,WType_Dialog | WShowModal); dummy.setFocusPolicy( QWidget::NoFocus ); qt_enter_modal(&dummy); qApp->enter_loop(); qt_leave_modal(&dummy); }
void QExtFileInfo::enter_loop() { QWidget dummy(0,0,WType_Dialog | WShowModal); dummy.setFocusPolicy( QWidget::NoFocus ); qt_enter_modal(&dummy); // kdDebug(24000)<<"QExtFileInfo::enter_loop:before qApp->enter_loop()"<<endl; qApp->enter_loop(); // kdDebug(24000)<<"QExtFileInfo::enter_loop:after qApp->enter_loop()"<<endl; qt_leave_modal(&dummy); }
void QWidget::destroy( bool destroyWindow, bool destroySubWindows ) { deactivateWidgetCleanup(); if ( testWState(WState_Created) ) { clearWState( WState_Created ); if ( children() ) { QObjectListIt it(*children()); register QObject *obj; while ( (obj=it.current()) ) { // destroy all widget children ++it; if ( obj->isWidgetType() ) ((QWidget*)obj)->destroy(destroySubWindows, destroySubWindows); } } releaseMouse(); if ( qt_pressGrab == this ) qt_pressGrab = 0; #ifndef QT_NO_QWS_MANAGER if (QWSManager::grabbedMouse() == this) { if ( extra && extra->topextra && extra->topextra->qwsManager ) { extra->topextra->qwsManager->releaseGrab(); } } #endif if ( keyboardGrb == this ) releaseKeyboard(); if ( testWFlags(WShowModal) ) // just be sure we leave modal qt_leave_modal( this ); else if ( testWFlags(WType_Popup) ) qApp->closePopup( this ); if ( testWFlags(WType_Desktop) ) { } else { if ( parentWidget() && parentWidget()->testWState(WState_Created) ) { hideWindow(); } if ( destroyWindow && isTopLevel() ) qwsDisplay()->destroyRegion( winId() ); } setWinId( 0 ); } }
/*! \internal */ bool QPrinter::pageSetup() { if(!psession && PMCreateSession(&psession) != noErr) return FALSE; QMacBlockingFunction block; //page format if(!prepare(&pformat)) return FALSE; { //simulate modality QWidget modal_widg(0, __FILE__ "__modal_dlg", Qt::WType_TopLevel | Qt::WStyle_Customize | Qt::WStyle_DialogBorder); qt_enter_modal(&modal_widg); Boolean ret; if(PMSessionPageSetupDialog(psession, pformat, &ret) != noErr) ret = FALSE; qt_leave_modal(&modal_widg); if(!ret) return FALSE; } interpret(&pformat); return TRUE; }
QRgb macGetRgba( QRgb initial, bool *ok, QWidget *parent, const char* ) { Point p = { -1, -1 }; const uchar *pstr = p_str("Choose a color"); static const int sw = 420, sh = 300; if(parent) { parent = parent->topLevelWidget(); p.h = (parent->x() + (parent->width() / 2)) - (sw / 2); p.v = (parent->y() + (parent->height() / 2)) - (sh / 2); QRect r = QApplication::desktop()->screenGeometry(QApplication::desktop()->screenNumber(parent)); if(p.h + sw > r.right()) p.h -= (p.h + sw) - r.right() + 10; if(p.v + sh > r.bottom()) p.v -= (p.v + sh) - r.bottom() + 10; } else if(QWidget *w = qApp->mainWidget()) { static int last_screen = -1; int scr = QApplication::desktop()->screenNumber(w); if(last_screen != scr) { QRect r = QApplication::desktop()->screenGeometry(scr); p.h = (r.x() + (r.width() / 2)) - (sw / 2); p.v = (r.y() + (r.height() / 2)) - (sh / 2); } } RGBColor rgb, rgbout; rgb.red = qRed(initial) * 256; rgb.blue = qBlue(initial) * 256; rgb.green = qGreen(initial) * 256; #if 1 Point place; place.h = p.h == -1 ? 0 : p.h; place.v = p.v == -1 ? 0 : p.v; Boolean rval = FALSE; { QMacBlockingFunction block; QWidget modal_widg(parent, __FILE__ "__modal_dlg", Qt::WType_TopLevel | Qt::WStyle_Customize | Qt::WStyle_DialogBorder); qt_enter_modal(&modal_widg); rval = GetColor(place, pstr, &rgb, &rgbout); qt_leave_modal(&modal_widg); } #else ColorPickerInfo cpInfo; // Set the input color to be an RGB color in system space. cpInfo.theColor.color.rgb.red = rgb.red; cpInfo.theColor.color.rgb.green = rgb.green; cpInfo.theColor.color.rgb.blue = rgb.blue; cpInfo.theColor.profile = 0L; cpInfo.dstProfile = 0L; cpInfo.flags = kColorPickerAppIsColorSyncAware | kColorPickerCanModifyPalette | kColorPickerCanAnimatePalette; // Place dialog cpInfo.placeWhere = kCenterOnMainScreen; if(p.h != -1 || p.v != -1) { cpInfo.placeWhere = kAtSpecifiedOrigin; cpInfo.dialogOrigin = p; } cpInfo.pickerType = 0L; // Use the default picker. cpInfo.eventProc = 0L; cpInfo.colorProc = 0L; cpInfo.colorProcData = 0L; memcpy(cpInfo.prompt, pstr, pstr[0]+1); Boolean rval = FALSE; { QMacBlockingFunction block; rval = (PickColor(&cpInfo) == noErr && cpInfo.newColorChosen); } if(rval) { rval = TRUE; if(!cpInfo.theColor.profile) { rgbout.red = cpInfo.theColor.color.rgb.red; rgbout.green = cpInfo.theColor.color.rgb.green; rgbout.blue = cpInfo.theColor.color.rgb.blue; } else { qDebug("not sure how to handle.."); } } #endif free((void *)pstr); if(ok) (*ok) = rval; if(!rval) return initial; initial = qRgba(rgbout.red / 256, rgbout.green / 256, rgbout.blue / 256, qAlpha(initial)); return initial; }