本文整理汇总了C++中kio::Job::setWindow方法的典型用法代码示例。如果您正苦于以下问题:C++ Job::setWindow方法的具体用法?C++ Job::setWindow怎么用?C++ Job::setWindow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kio::Job
的用法示例。
在下文中一共展示了Job::setWindow方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: internalCopy
bool QExtFileInfo::internalCopy(const KURL& src, const KURL& target, int permissions,
bool overwrite, bool resume, QWidget* window)
{
bJobOK = true; // success unless further error occurs
KIO::Scheduler::checkSlaveOnHold(true);
KIO::Job * job = KIO::file_copy( src, target, permissions, overwrite, resume );
job->setWindow (window);
connect( job, SIGNAL( result (KIO::Job *) ),
this, SLOT( slotResult (KIO::Job *) ) );
enter_loop();
return bJobOK;
}
示例2: rect
void
RadialMap::Widget::mousePressEvent( QMouseEvent *e )
{
//m_tip is hidden already by event filter
//m_focus is set correctly (I've been strict, I assure you it is correct!)
enum { Konqueror, Konsole, Center, Open, Copy, Delete };
if (m_focus && !m_focus->isFake())
{
const KURL url = Widget::url( m_focus->file() );
const bool isDir = m_focus->file()->isDirectory();
if( e->button() == Qt::RightButton )
{
KPopupMenu popup;
popup.insertTitle( m_focus->file()->fullPath( m_tree ) );
if (isDir) {
popup.insertItem( SmallIconSet( "konqueror" ), i18n( "Open &Konqueror Here" ), Konqueror );
if( url.protocol() == "file" )
popup.insertItem( SmallIconSet( "konsole" ), i18n( "Open &Konsole Here" ), Konsole );
if (m_focus->file() != m_tree) {
popup.insertSeparator();
popup.insertItem( SmallIconSet( "viewmag" ), i18n( "&Center Map Here" ), Center );
}
}
else
popup.insertItem( SmallIconSet( "fileopen" ), i18n( "&Open" ), Open );
popup.insertSeparator();
popup.insertItem( SmallIconSet( "editcopy" ), i18n( "&Copy to clipboard" ), Copy );
popup.insertSeparator();
popup.insertItem( SmallIconSet( "editdelete" ), i18n( "&Delete" ), Delete );
switch (popup.exec( e->globalPos(), 1 )) {
case Konqueror:
//KRun::runCommand will show an error message if there was trouble
KRun::runCommand( QString( "kfmclient openURL \"%1\"" ).arg( url.url() ) );
break;
case Konsole:
// --workdir only works for local file paths
KRun::runCommand( QString( "konsole --workdir \"%1\"" ).arg( url.path() ) );
break;
case Center:
case Open:
goto section_two;
case Copy:
QApplication::clipboard()->setData( new KURLDrag( KURL::List( url ) ) );
break;
case Delete:
{
const KURL url = Widget::url( m_focus->file() );
const QString message = m_focus->file()->isDirectory()
? i18n( "<qt>The directory at <i>'%1'</i> will be <b>recursively</b> and <b>permanently</b> deleted." )
: i18n( "<qt><i>'%1'</i> will be <b>permanently</b> deleted." );
const int userIntention = KMessageBox::warningContinueCancel(
this, message.arg( url.prettyURL() ),
QString::null, KGuiItem( i18n("&Delete"), "editdelete" ) );
if (userIntention == KMessageBox::Continue) {
KIO::Job *job = KIO::del( url );
job->setWindow( this );
connect( job, SIGNAL(result( KIO::Job* )), SLOT(deleteJobFinished( KIO::Job* )) );
QApplication::setOverrideCursor( KCursor::workingCursor() );
}
}
default:
//ensure m_focus is set for new mouse position
sendFakeMouseEvent();
}
}
else { // not right mouse button
section_two:
const QRect rect( e->x() - 20, e->y() - 20, 40, 40 );
m_tip->hide(); // user expects this
if (!isDir || e->button() == Qt::MidButton) {
KIconEffect::visualActivate( this, rect );
new KRun( url, this, true ); //FIXME see above
}
else if (m_focus->file() != m_tree) { // is left click
KIconEffect::visualActivate( this, rect );
emit activated( url ); //activate first, this will cause UI to prepare itself
createFromCache( (Directory *)m_focus->file() );
}
else
emit giveMeTreeFor( url.upURL() );
}
}
//.........这里部分代码省略.........