当前位置: 首页>>代码示例>>C++>>正文


C++ Job::setWindow方法代码示例

本文整理汇总了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;
}
开发者ID:KDE,项目名称:quanta,代码行数:14,代码来源:qextfileinfo.cpp

示例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() );
      }
   }
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:macfilelight-svn,代码行数:101,代码来源:widgetEvents.cpp


注:本文中的kio::Job::setWindow方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。