Give KMessageBoxes a parent widget.

BUGS: 143612

svn path=/branches/KDE/3.5/kdegraphics/kpdf/; revision=648173
remotes/origin/kpdf-3.5
Albert Astals Cid 19 years ago
parent e312383852
commit 165e088a35
  1. 19
      core/document.cpp
  2. 5
      core/document.h
  3. 2
      core/generator_pdf/generator_pdf.cpp
  4. 2
      part.cpp

@ -106,8 +106,8 @@ struct RunningSearch
/** KPDFDocument **/
KPDFDocument::KPDFDocument()
: generator( 0 ), d( new KPDFDocumentPrivate )
KPDFDocument::KPDFDocument(QWidget *widget)
: QObject(widget), generator( 0 ), d( new KPDFDocumentPrivate )
{
d->allocatedPixmapsTotalMemory = 0;
d->memCheckTimer = 0;
@ -355,6 +355,11 @@ void KPDFDocument::reparseConfig()
}
QWidget *KPDFDocument::widget() const
{
return static_cast<QWidget*>(parent());
}
bool KPDFDocument::isOpened() const
{
return generator;
@ -742,7 +747,7 @@ bool KPDFDocument::searchText( int searchID, const QString & text, bool fromStar
{
if ( currentPage >= pageCount )
{
if ( noDialogs || KMessageBox::questionYesNo(0, i18n("End of document reached.\nContinue from the beginning?"), QString::null, KStdGuiItem::cont(), KStdGuiItem::cancel()) == KMessageBox::Yes )
if ( noDialogs || KMessageBox::questionYesNo(widget(), i18n("End of document reached.\nContinue from the beginning?"), QString::null, KStdGuiItem::cont(), KStdGuiItem::cancel()) == KMessageBox::Yes )
currentPage = 0;
else
break;
@ -788,7 +793,7 @@ bool KPDFDocument::searchText( int searchID, const QString & text, bool fromStar
}
}
else if ( !noDialogs )
KMessageBox::information( 0, i18n("No matches found for '%1'.").arg( text ) );
KMessageBox::information( widget(), i18n("No matches found for '%1'.").arg( text ) );
}
// 3. PREVMATCH //TODO
else if ( type == PrevMatch )
@ -990,7 +995,7 @@ void KPDFDocument::processLink( const KPDFLink * link )
{
// this case is a link pointing to an executable with a parameter
// that also is an executable, possibly a hand-crafted pdf
KMessageBox::information( 0, i18n("The pdf file is trying to execute an external application and for your safety kpdf does not allow that.") );
KMessageBox::information( widget(), i18n("The pdf file is trying to execute an external application and for your safety kpdf does not allow that.") );
return;
}
}
@ -998,7 +1003,7 @@ void KPDFDocument::processLink( const KPDFLink * link )
{
// this case is a link pointing to an executable with no parameters
// core developers find unacceptable executing it even after asking the user
KMessageBox::information( 0, i18n("The pdf file is trying to execute an external application and for your safety kpdf does not allow that.") );
KMessageBox::information( widget(), i18n("The pdf file is trying to execute an external application and for your safety kpdf does not allow that.") );
return;
}
}
@ -1011,7 +1016,7 @@ void KPDFDocument::processLink( const KPDFLink * link )
KRun::run( *ptr, lst );
}
else
KMessageBox::information( 0, i18n( "No application found for opening file of mimetype %1." ).arg( mime->name() ) );
KMessageBox::information( widget(), i18n( "No application found for opening file of mimetype %1." ).arg( mime->name() ) );
} break;
case KPDFLink::Action: {

@ -51,7 +51,7 @@ class KPDFDocument : public QObject
{
Q_OBJECT
public:
KPDFDocument();
KPDFDocument( QWidget *widget );
~KPDFDocument();
// document handling
@ -66,6 +66,9 @@ class KPDFDocument : public QObject
// enum definitions
enum Permission { AllowModify = 1, AllowCopy = 2, AllowPrint = 4, AllowNotes = 8 };
// returns the widget where the document is shown
QWidget *widget() const;
// query methods (const ones)
bool isOpened() const;
const DocumentInfo * documentInfo() const;

@ -466,7 +466,7 @@ bool PDFGenerator::print( KPrinter& printer )
double yScale = ((double)paperHeight - (double)marginBottom - (double)marginTop) / (double)paperHeight;
if ( abs((int)(xScale * 100) - (int)(yScale * 100)) > 5 ) {
int result = KMessageBox::questionYesNo(0,
int result = KMessageBox::questionYesNo(m_document->widget(),
i18n("The margins you specified change the page aspect ratio. Do you want to print with the aspect ratio changed or do you want the margins to be adapted so that the aspect ratio is preserved?"),
i18n("Aspect ratio change"),
i18n("Print with specified margins"),

@ -110,7 +110,7 @@ Part::Part(QWidget *parentWidget, const char *widgetName,
setInstance(KPDFPartFactory::instance());
// build the document
m_document = new KPDFDocument();
m_document = new KPDFDocument(widget());
connect( m_document, SIGNAL( linkFind() ), this, SLOT( slotFind() ) );
connect( m_document, SIGNAL( linkGoToPage() ), this, SLOT( slotGoToPage() ) );
connect( m_document, SIGNAL( linkPresentation() ), this, SLOT( slotShowPresentation() ) );

Loading…
Cancel
Save