コード例 #1
0
void AlbumModificationHelper::slotAlbumDelete(PAlbum* album)
{
    if (!album || album->isRoot() || album->isAlbumRoot())
    {
        return;
    }

    // find subalbums
    KUrl::List childrenList;
    addAlbumChildrenToList(childrenList, album);

    DeleteDialog dialog(d->dialogParent);

    // All subalbums will be presented in the list as well
    if (!dialog.confirmDeleteList(childrenList,
                                  childrenList.size() == 1 ?
                                  DeleteDialogMode::Albums : DeleteDialogMode::Subalbums,
                                  DeleteDialogMode::UserPreference))
    {
        return;
    }

    bool useTrash = !dialog.shouldDelete();

    // Currently trash kioslave can handle only full paths.
    // pass full folder path to the trashing job
    DIO::del(album, useTrash);
}
コード例 #2
0
void KipiInterface::refreshImages(const KUrl::List& urls)
{
    kipiDebug(QString( "Plugin asks to refresh %1 images:").arg( urls.size() ));
    for (KUrl::List::ConstIterator it = urls.constBegin(); it!=urls.constEnd(); ++it)
    {
        kipiDebug("  " + (*it).url());
    }
}
コード例 #3
0
ファイル: wmwidget.cpp プロジェクト: tejastank/kipi-plugins
void WmWidget::slotApplyTitle()
{
    kDebug() << "ApplyTitle";

    QString givenTitle = title();
    QString imageTitle;
    QString number;
    QString originalExtension;
    QString currentExtension;
    KUrl::List urls;
    QMap<QString, QString> imageMetaData;
    QList<QTreeWidgetItem*> selectedItems = d->imgList->listView()->selectedItems();
    QStringList parts;

    const int minLength = givenTitle.count("#");

    // Build the list of items to rename
    for (int i = 0; i < selectedItems.size(); ++i)
    {
        KPImagesListViewItem* l_item = dynamic_cast<KPImagesListViewItem*>(selectedItems.at(i));
        urls.append(l_item->url());
    }

    for (int i = 0; i < urls.size(); ++i)
    {
        imageMetaData = d->imagesDescInfo[urls.at(i).path()];
        imageTitle = givenTitle;

        // If there is at least one #, replace it the correct number
        if(minLength > 0)
        {
            parts = imageTitle.split("#", QString::KeepEmptyParts);
            imageTitle = parts.first().append("#").append(parts.last());
            number = QString::number(i + 1);
            while (number.length() < minLength)
            {
                number.prepend("0");
            }
            imageTitle.replace(imageTitle.indexOf("#"), 1, number);
        }

        // Add original extension if removed
        currentExtension = imageTitle.split('.').last();
        originalExtension = urls.at(i).path().split('.').last();
        if(QString::compare(currentExtension, originalExtension, Qt::CaseInsensitive) != 0)
        {
            imageTitle.append(".").append(originalExtension);
            d->titleEdit->setText(imageTitle);
        }

        kDebug() << urls.at(i).path() << "renamed to" << imageTitle;
        imageMetaData["title"] = imageTitle;
        d->imagesDescInfo[urls.at(i).path()] = imageMetaData;
    }
}
コード例 #4
0
void ImageReductionDlg::addDarkFile()
{
   KURL::List fileURLs = KFileDialog::getOpenURLs( QString::null, "*.fits *.fit *.fts|Flexible Image Transport System", 0, i18n("Dark Frames"));
  
  const int limit = (int) fileURLs.size();
  for (int i=0; i < limit ; ++i)
  	new QListViewItem( darkListView, fileURLs[i].path());
  
  darkRemoveB->setEnabled(true);
  darkDetailsB->setEnabled(true);

}
コード例 #5
0
ファイル: wmwidget.cpp プロジェクト: tejastank/kipi-plugins
void WmWidget::loadImageInfoFirstLoad()
{
    KUrl::List urls = d->imgList->imageUrls(false);

    QString title;
    QString date;
    QString description;
    QString currentCategories;
    QString latitude;
    QString longitude;

    for(int j = 0; j < urls.size(); j++)
    {
        KPImageInfo info(urls.at(j).path());
        QStringList keywar = info.keywords();
        date               = info.date().toString(Qt::ISODate);
        date               = date.replace("T", " ", Qt::CaseSensitive);
        title              = info.name();
        description        = info.title();
        currentCategories  = "";

        for( int i = 0; i < keywar.size(); i++)
        {
            if(i == keywar.size()-1)
            {
                currentCategories.append(keywar.at(i));
            }
            else
            {
                currentCategories.append(keywar.at(i)).append("\n");
            }
        }

        if(info.hasLatitude())
        {
            latitude = QString::number(info.latitude());
        }

        if(info.hasLongitude())
        {
            longitude = QString::number(info.longitude());
        }

        QMap<QString, QString> imageMetaData;
        imageMetaData["title"]       = title;
        imageMetaData["date"]        = date;
        imageMetaData["categories"]  = currentCategories;
        imageMetaData["description"] = description;
        imageMetaData["latitude"]    = latitude;
        imageMetaData["longitude"]   = longitude;
        d->imagesDescInfo.insert(urls.at(j).path(), imageMetaData);
    }
}
コード例 #6
0
ファイル: quicklauncher.cpp プロジェクト: Fat-Zer/tdebase
void QuickLauncher::dragEnterEvent(TQDragEnterEvent *e)
{
    DEBUGSTR << "QuickLauncher::dragEnterEvent(pos=" << e->pos() << 
        " type=" << e->type() << ")" << endl << flush;
    m_dragAccepted=false;
    KURL::List kurlList;
    if (!isDragEnabled() || !KURLDrag::decode(e, kurlList)) 
    {
        e->accept(false);
        return;
    }

    if (kurlList.size()<=0)
    {
        e->accept(false);
        return;
    }
    m_dragButtons=new ButtonGroup;
    m_oldButtons=new ButtonGroup(*m_buttons);

    TQString url;
    KURL::List::ConstIterator it = kurlList.begin();
    for ( ; it != kurlList.end(); ++it )
    {
        url = QuickURL((*it).url()).url();
        kdDebug() << "    Drag Object='"<<url<<"' " << (*it).url() << endl;
        int pos = m_buttons->findDescriptor(url);
        if (pos != NotFound)
        {
            // if it's already in m_buttons, take it out
            m_dragButtons->push_back(m_buttons->takeFrom(pos));
        }
        else
        {
            // otherwise, create a new one
            QuickButton* button = createButton(url);
            button->setSticky(true);
            m_dragButtons->push_back(button);
        }
    }
    if (m_dragButtons->size() > 0)
    {
        //make sure we can drag at least one button.
        m_dragAccepted=true;
        m_newButtons=new ButtonGroup(*m_buttons);
        m_dropPos=NotFound;
        e->accept(true);
        return;
    }
    e->accept(false);
    clearTempButtons();
}
コード例 #7
0
ファイル: wmwidget.cpp プロジェクト: tejastank/kipi-plugins
QMap <QString,QMap <QString,QString> > WmWidget::allImagesDesc()
{
    KUrl::List urls = d->imgList->imageUrls(false);

    for (int i = 0; i < urls.size(); ++i)
    {

        QMap<QString, QString> imageMetaData = d->imagesDescInfo[urls.at(i).path()];
        imageMetaData["author"]              = author();
        imageMetaData["source"]              = source();
        imageMetaData["license"]             = license();
        imageMetaData["genCategories"]       = genCategories();
        imageMetaData["genText"]             = genText();
        d->imagesDescInfo[urls.at(i).path()] = imageMetaData;
    }

    return d->imagesDescInfo;
}
コード例 #8
0
ファイル: wmwidget.cpp プロジェクト: kratuna/kipi-plugins
void WmWidget::slotApplyImagesDesc(){

    //-- enregistrement des edit dans la map

    KUrl::List urls;
    QList<QTreeWidgetItem *> selectedItems=m_imgList->listView()->selectedItems();

    for (int i = 0; i < selectedItems.size(); ++i){
        KPImagesListViewItem* l_item = dynamic_cast<KPImagesListViewItem*>(selectedItems.at(i));
    urls.append(l_item->url());
    }

    for (int i = 0; i < urls.size(); ++i)
    {

        QMap<QString, QString> imageMetaData;
        imageMetaData = m_imagesDescInfo[urls.at(i).path()];

        if(m_titleCheck->isChecked()){
            QString url = urls.at(i).path().split('/').last();
            url = title();
            if(url.split('.').last().isEmpty()){
                url = url +"."+urls.at(i).path().split('.').last();
                m_titleEdit->setText(url);
            }
            kDebug()<<" Url in the if "<<url;
            imageMetaData["title"]   = url;
            kDebug()<<" Url after if "<<url;
        }

        if(m_dateCheck->isChecked()){
            imageMetaData["time"] = date();
        }
        if(m_categoryCheck->isChecked()){
            imageMetaData["categories"] = categories();
        }
        if(m_descCheck->isChecked()){
            imageMetaData["description"] = description();
        }
        m_imagesDescInfo[urls.at(i).path()]=imageMetaData;

    }

}
コード例 #9
0
ファイル: wmwidget.cpp プロジェクト: tejastank/kipi-plugins
void WmWidget::slotApplyLongitude()
{
    KUrl::List urls;
    QList<QTreeWidgetItem*> selectedItems = d->imgList->listView()->selectedItems();

    for (int i = 0; i < selectedItems.size(); ++i)
    {
        KPImagesListViewItem* l_item = dynamic_cast<KPImagesListViewItem*>(selectedItems.at(i));
        urls.append(l_item->url());
    }

    for (int i = 0; i < urls.size(); ++i)
    {
        QMap<QString, QString> imageMetaData;
        imageMetaData                       = d->imagesDescInfo[urls.at(i).path()];
        imageMetaData["longitude"]          = longitude();
        d->imagesDescInfo[urls.at(i).path()] = imageMetaData;
    }
}
コード例 #10
0
ファイル: wmwidget.cpp プロジェクト: kratuna/kipi-plugins
QMap <QString,QMap <QString,QString> > WmWidget::allImagesDesc()
{

    KUrl::List urls = m_imgList->imageUrls(false);


    for (int i = 0; i < urls.size(); ++i)
    {

        QMap<QString, QString> imageMetaData = m_imagesDescInfo[urls.at(i).path()];

            imageMetaData["author"] = author();
            imageMetaData["license"] = license();

        m_imagesDescInfo[urls.at(i).path()]=imageMetaData;

    }

    return m_imagesDescInfo;
}
コード例 #11
0
ファイル: wmwindow.cpp プロジェクト: kratuna/kipi-plugins
void WMWindow::slotStartTransfer()
{
    saveSettings();
    KUrl::List urls = iface()->currentSelection().images();


    QMap <QString,QMap <QString,QString> > imagesDesc=m_widget->allImagesDesc();


    for (int i = 0; i < urls.size(); ++i)
    {

        QString caption;
        QString url;
        if(m_widget->resize()){

            prepareImageForUpload(urls.at(i).path(), caption);

            ;
            imagesDesc.insert(m_tmpPath, imagesDesc.take(urls.at(i).path()));

        }
    }

    m_uploadJob->setImageMap(imagesDesc);

    m_widget->progressBar()->setRange(0, 100);
    m_widget->progressBar()->setValue(0);

    connect(m_uploadJob, SIGNAL(uploadProgress(int)),
            m_widget->progressBar(), SLOT(setValue(int)));

    connect(m_uploadJob, SIGNAL(endUpload()),
            this, SLOT(slotEndUpload()));

    m_widget->progressBar()->show();
    m_widget->progressBar()->progressScheduled(i18n("Wiki Export"), true, true);
    m_widget->progressBar()->progressThumbnailChanged(KIcon("kipi").pixmap(22, 22));
    m_uploadJob->begin();
}