RocketFtpDialog::RocketFtpDialog(RocketImageList *list, QWidget *parent) : QDialog(parent) {
    images = list;
    setupUi(this);
    statusBar = new QStatusBar(this);
    statusBar->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    statusBar->setSizeGripEnabled(false);
    progressBar = new QProgressBar(statusBar);
    progressBar->setTextVisible(false);
    new QHBoxLayout(progressBar);
    progressBar->layout()->setMargin(0);
    statusLabel = new QLabel("Ready.", progressBar);
    statusLabel->setAlignment(Qt::AlignLeft|Qt::AlignVCenter);
    progressBar->layout()->addItem(new QSpacerItem(5, 5));
    progressBar->layout()->addWidget(statusLabel);
    statusBar->addWidget(progressBar, 1);
    layout()->addWidget(statusBar);
    connect(btnUpload, SIGNAL(clicked()), SLOT(uploadClicked()));
    connect(btnClose, SIGNAL(clicked()), SLOT(closeClicked()));
    connect(btnBrowse, SIGNAL(clicked()), SLOT(browseClicked()));
    linPort->setValidator(new QIntValidator(0, 65535, linPort));
    
    QSettings settings;
    settings.beginGroup("ftp");
    linAddress->setText(settings.value("address", "").toString());
    linPort->setText(settings.value("port", "21").toString());
    linUsername->setText(settings.value("username", "").toString());
    linPassword->setText(settings.value("password", "").toString());
    linLocation->setText(settings.value("location", "").toString());
}
DroneshareUploadDialog::DroneshareUploadDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::DroneshareUploadDialog),
    m_uasInterface(NULL),
    m_droneshareUpload(NULL),
    m_droneshareQuery(NULL)
{
    ui->setupUi(this);

    connect(ui->closeButton, SIGNAL(clicked()), this, SLOT(closeButtonClicked()));
    connect(ui->uploadButton, SIGNAL(clicked()), this, SLOT(uploadClicked()));

    connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)),
            this, SLOT(activeUASSet(UASInterface*)));
    activeUASSet(UASManager::instance()->getActiveUAS());
}
void ListWidgetButtonContainer::setButtons(const RecordItNow::CollectionListWidget::ButtonCodes &buttons)
{

    m_buttons.clear();

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->setContentsMargins(-1, -1, -1, 0);
    mainLayout->setSizeConstraint(QVBoxLayout::SetMinimumSize);

    KSeparator *mainSeparator = new KSeparator(this);
    mainSeparator->setFrameShape(KSeparator::HLine);

    QHBoxLayout *layout = new QHBoxLayout;
    layout->setContentsMargins(0, 0, 0, 0);
    layout->setSizeConstraint(QLayout::SetMinimumSize);

    mainLayout->addLayout(layout);
    mainLayout->addWidget(mainSeparator);

    QToolButton *button = 0;
    if (buttons & CollectionListWidget::PlayButton) {
        button = newButton(this);
        button->setIcon(KIcon("media-playback-start"));
        button->setToolTip(i18n("Play"));
        connect(button, SIGNAL(clicked()), this, SIGNAL(playClicked()));

        layout->addWidget(button);
        m_buttons.insert(CollectionListWidget::PlayButton, button);
    }
/*
    if (button) {
        KSeparator *separator = new KSeparator(this);
        separator->setFrameShape(QFrame::VLine);
        layout->addWidget(separator);
    }
*/

    if (buttons & CollectionListWidget::UploadButton) {
        button = newButton(this);
        button->setIcon(KIcon("recorditnow-upload-media"));
        button->setToolTip(i18n("Upload"));
        connect(button, SIGNAL(clicked()), this, SIGNAL(uploadClicked()));

        layout->addWidget(button);
        m_buttons.insert(CollectionListWidget::UploadButton, button);
    }

    if (buttons & CollectionListWidget::AddButton) {
        button = newButton(this);
        button->setIcon(KIcon("list-add"));
        button->setToolTip(i18n("Add"));
        connect(button, SIGNAL(clicked()), this, SIGNAL(addClicked()));

        layout->addWidget(button);
        m_buttons.insert(CollectionListWidget::AddButton, button);
    }

    if (buttons & CollectionListWidget::EditButton) {
        button = newButton(this);
        button->setIcon(KIcon("document-edit"));
        button->setToolTip(i18n("Edit"));
        connect(button, SIGNAL(clicked()), this, SIGNAL(editClicked()));

        layout->addWidget(button);
        m_buttons.insert(CollectionListWidget::EditButton, button);
    }

    if (buttons & CollectionListWidget::DeleteButton) {
        button = newButton(this);
        button->setIcon(KIcon("edit-delete"));
        button->setToolTip(i18n("Delete"));
        connect(button, SIGNAL(clicked()), this, SIGNAL(deleteClicked()));

        layout->addWidget(button);
        m_buttons.insert(CollectionListWidget::DeleteButton, button);
    }

    QWidget *spacer = new QWidget(this);
    spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
    layout->addWidget(spacer);

    setLayout(mainLayout);

}