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

Basket * Container::loadBasket ( const QString &  folderName,
bool  save = true,
bool  showErrors = true 
) [slot]

Baskets manipulations

Definition at line 2006 of file container.cpp.

References DecoratedBasket::basket(), basketNameChanged(), Basket::fullPath(), Basket::icon(), and Basket::successfulyLoaded().

Referenced by loadBaskets().

{
      if (folderName.isEmpty())
            return 0L;

      DecoratedBasket *decoBasket = new DecoratedBasket(m_tab, folderName);
      Basket *basket = decoBasket->basket();

      if ( ! basket->successfulyLoaded() ) {
            if (showErrors)
                  KMessageBox::error( this, /* TODO FIXME i18n*/QString(
                        "<p>The basket <b>%1</b> failed to load.</p>"
                        "<p>Please check if it exists, is readable and if data aren't corrupted.</p>").arg(basket->fullPath()),
                        /*i18n*/QString("Basket Load Failure") );
            delete decoBasket;
            return 0L;
      }

      m_tab->addTab(decoBasket, basket->name());
      basketIconChanged(basket, basket->icon()); // Do not take pain to create an inconloader / iconset for addTab()
      m_tab->showPage(decoBasket);

      connect( basket, SIGNAL(nameChanged(Basket*, const QString&)), this, SLOT(basketNameChanged(Basket*, const QString&)) );
      connect( basket, SIGNAL(iconChanged(Basket*, const QString&)), this, SLOT(basketIconChanged(Basket*, const QString&)) );
      connect( basket, SIGNAL(changedSelectedItems()),               this, SLOT(changedSelectedItems())                     );
      connect( basket, SIGNAL(areSelectedItemsCheckedChanged(bool)), this, SLOT(areSelectedItemsCheckedChanged(bool))       );

      basketNumberChanged();
      rebuildBasketsMenu();

      if (save) // Save the list of baskets, whereas save is false (eg. during the load of each baskets)
            this->save();

      return basket;
}


Generated by  Doxygen 1.6.0   Back to index