Logo Search packages:      
Sourcecode: basket version File versions  Download package

Basket::Basket ( QWidget *  parent,
const QString &  folderName,
const char *  name = "",
WFlags  fl = 0 
)

Construtor and destructor

Definition at line 142 of file basket.cpp.

References KDirWatch::addDir(), m_firstItem, KDirWatch::startScan(), and KDirWatch::stopScan().

 : QScrollView(parent, name, fl)
{
      setFocusPolicy(QWidget::StrongFocus);
      enableClipper(true);
      setAcceptDrops(true);
      setDragAutoScroll(true);

      m_isLoaded                  = false;
      m_firstItem                 = 0L;
      m_lastItem                  = 0L;
      m_firstShownItem            = 0L;
      m_lastShownItem             = 0L;
      m_count                     = 0;
      m_countShown                = 0;
      m_focusedItem               = 0L;
      m_startOfShiftSelectionItem = 0L;
      m_countSelecteds            = 0;
      m_areSelectedItemsChecked   = false;
      m_editor                    = 0L;
      m_isDuringDrag              = false;
      m_clickedToExitEdit         = false;
      m_stackedKeyEvent           = 0L;

      m_ViewFileContent = new bool[TOTAL];
      for (int i = 0; i < TOTAL; ++i)
            m_ViewFileContent[i] = (i != FileText) && (i != FileHTML);

      m_folderName = folderName;
      if ( ! folderName.endsWith("/") )
            m_folderName = folderName + "/";

      m_frameInsertTo = new QFrame(this); // Needed by insertItem() [called by load()]
      m_frameInsertTo->setFrameShape(QFrame::HLine);
      m_frameInsertTo->setFrameShadow(QFrame::Plain);
      m_frameInsertTo->setLineWidth(2);
      m_frameInsertTo->setFixedHeight(2);
      m_frameInsertTo->setPaletteForegroundColor(KApplication::palette().active().dark());
      m_frameInsertTo->hide();

      for (int i = 0; i < 4; ++i) {
            m_framesIT[i] = new QFrame(this); // Needed by insertItem() [called by load()]
            m_framesIT[i]->setFrameShape(QFrame::VLine);
            m_framesIT[i]->setFrameShadow(QFrame::Plain);
            m_framesIT[i]->setLineWidth(1);
            m_framesIT[i]->setFixedWidth(1);
            m_framesIT[i]->setFixedHeight(4 + 2 * (i == 0 || i == 3));
            m_framesIT[i]->setPaletteForegroundColor(KApplication::palette().active().dark());
            m_framesIT[i]->hide();
      }

      m_emptyHelp = new QVBox(viewport()); // Create it now to avoid segfaults

      // Create m_watcher before load() because mirrored files should be added to it
      m_watcher = new KDirWatch(this);
      m_watcher->addDir(fullPath(), true); // Watch all files modifications
      connect( m_watcher,     SIGNAL(dirty(const QString&)),   this, SLOT(slotModifiedFile(const QString&)) );
      connect( m_watcher,     SIGNAL(created(const QString&)), this, SLOT(slotCreatedFile(const QString&))  );
      connect( m_watcher,     SIGNAL(deleted(const QString&)), this, SLOT(slotDeletedFile(const QString&))  );
      connect(&m_updateTimer, SIGNAL(timeout()),               this, SLOT(slotUpdateItems())                );

      m_watcher->stopScan();
      load(); // We disable Dir scan during load, in case files are created (when importing launchers)
      m_watcher->startScan();
      resetSearch();

      ((QVBox*)m_emptyHelp)->setSpacing(6);
      addChild(m_emptyHelp);
      new QLabel(i18n(
            "Use the <b>Insert</b> menu to add items.<br>"
            "You also can <b>drop</b> or <b>paste</b> objects here.").replace(" ", "&nbsp;")/*Do not warp*/, m_emptyHelp);
      KURLLabel *help = new KURLLabel(m_emptyHelp, "URLLabel");
      help->setText(i18n("What is this application?"));
      connect( help, SIGNAL(leftClickedURL()), Global::mainContainer, SLOT(showAppPurpose()) );
      m_dontShowEmptyHelp = new QCheckBox(i18n("&Do not show this message again"), m_emptyHelp);
      m_emptyHelp->setFixedSize(m_emptyHelp->sizeHint());
      connect( m_dontShowEmptyHelp, SIGNAL(toggled(bool)), Global::mainContainer, SLOT(slotDontShowEmptyHelp(bool)) );
}


Generated by  Doxygen 1.6.0   Back to index