예제 #1
0
파일: noteedit.cpp 프로젝트: tosky/basket
LinkEditor::LinkEditor(LinkContent *linkContent, QWidget *parent)
        : NoteEditor(linkContent)
{
    QPointer<LinkEditDialog> dialog = new LinkEditDialog(linkContent, parent);
    if (dialog->exec() == QDialog::Rejected)
        cancel();
    if (linkContent->url().isEmpty() && linkContent->title().isEmpty())
        setEmpty();
}
예제 #2
0
void modCalcVlsr::slotFindObject() {
    QPointer<FindDialog> fd = new FindDialog( KStars::Instance() );
    if ( fd->exec() == QDialog::Accepted ) {
        SkyObject *o = fd->selectedObject();
        RA->showInHours( o->ra0() );
        Dec->showInDegrees( o->dec0() );
    }
    delete fd;
}
예제 #3
0
파일: keyinfodialog.cpp 프로젝트: KDE/kgpg
void KgpgKeyInfo::slotChangeDate()
{
	QPointer<SelectExpiryDate> dialog = new SelectExpiryDate(this, m_node->getExpiration());
	if (dialog->exec() == QDialog::Accepted) {
		keychange->setExpiration(dialog->date());
		buttonBox->button(QDialogButtonBox::Apply)->setEnabled(keychange->wasChanged());
	}
	delete dialog;
}
예제 #4
0
        QString RecipientDialog::getNickname(QWidget* parent, QAbstractListModel* model)
        {
            QPointer<RecipientDialog> dlg = new RecipientDialog(parent, model);
            dlg->exec();
            const QString selectedNick = dlg->getSelectedNickname();

            delete dlg;
            return selectedNick;
        }
void CheckGravatarPluginInterface::exec()
{
    if (mListItems.isEmpty()) {
        KMessageBox::sorry(parentWidget(), i18n("You have not selected any contacts."));
    } else {
        if (mListItems.count() == 1) {
            Akonadi::Item item = mListItems.first();
            if (item.hasPayload<KContacts::Addressee>()) {
                KContacts::Addressee address = item.payload<KContacts::Addressee>();
                const QString email = address.preferredEmail();
                if (email.isEmpty()) {
                    KMessageBox::error(parentWidget(), i18n("No email found for this contact."));
                    return;
                }
                QPointer<KABGravatar::GravatarUpdateDialog> dlg = new KABGravatar::GravatarUpdateDialog(parentWidget());
                dlg->setEmail(email);
                if (!address.photo().isEmpty()) {
                    if (address.photo().isIntern()) {
                        const QPixmap pix = QPixmap::fromImage(address.photo().data());
                        dlg->setOriginalPixmap(pix);
                    } else {
                        dlg->setOriginalUrl(QUrl(address.photo().url()));
                    }
                }
                if (dlg->exec()) {
                    KContacts::Picture picture = address.photo();
                    bool needToSave = false;
                    if (dlg->saveUrl()) {
                        const QUrl url = dlg->resolvedUrl();
                        if (!url.isEmpty()) {
                            picture.setUrl(url.toString());
                            needToSave = true;
                        }
                    } else {
                        const QPixmap pix = dlg->pixmap();
                        if (!pix.isNull()) {
                            picture.setData(pix.toImage());
                            needToSave = true;
                        }
                    }
                    if (needToSave) {
                        address.setPhoto(picture);
                        item.setPayload<KContacts::Addressee>(address);

                        Akonadi::ItemModifyJob *modifyJob = new Akonadi::ItemModifyJob(item, this);
                        connect(modifyJob, &Akonadi::ItemModifyJob::result, this, &CheckGravatarPluginInterface::slotModifyContactFinished);
                    }
                }
                delete dlg;
            } else {
                KMessageBox::information(parentWidget(), i18n("A contact group was selected."));
            }
        } else {
            KMessageBox::information(parentWidget(), i18n("Too many contacts selected."));
        }
    }
}
예제 #6
0
파일: postentry.cpp 프로젝트: KDE/kdepim
void PostEntry::submitPost(int blogId, const BilboPost &postData)
{
    setCurrentPostFromEditor();
    if (d->mCurrentPost.content().isEmpty() || d->mCurrentPost.title().isEmpty()) {
        if (KMessageBox::warningContinueCancel(this,
                                               i18n("Your post title or body is empty.\nAre you sure you want to submit this post?")
                                              ) == KMessageBox::Cancel) {
            return;
        }
    }
    bool isNew = false;
    if (d->mCurrentPost.status() == BilboPost::New) {
        isNew = true;
    }
    QPointer<SendToBlogDialog> dia = new SendToBlogDialog(isNew, d->mCurrentPost.isPrivate(), this);
    dia->setAttribute(Qt::WA_DeleteOnClose, false);
    if (dia->exec() == QDialog::Accepted) {
        this->setCursor(Qt::BusyCursor);
        d->mCurrentPost.setProperties(postData);
        d->mCurrentPostBlogId = blogId;

        QString msgType;
        if (dia->isPrivate()) {
            msgType =  i18nc("Post status, e.g Draft or Published Post", "draft");
            d->mCurrentPost.setPrivate(true);
        } else {
            msgType =  i18nc("Post status, e.g Draft or Published Post", "post");
            d->mCurrentPost.setPrivate(false);
        }

        QString statusMsg;
        if (dia->isNew()) {
            statusMsg = i18n("Submitting new %1...", msgType);
            d->isNewPost = true;
        } else {
            statusMsg = i18n("Modifying %1...", msgType);
            d->isNewPost = false;
        }

        Q_EMIT showStatusMessage(statusMsg, true);
        Backend *b = new Backend(d->mCurrentPostBlogId, this);
        connect(b, &Backend::sigError, this, &PostEntry::slotError);
        if (uploadMediaFiles(b)) {
            qCDebug(BLOGILO_LOG) << "Uploading";
            showProgressBar();
            connect(b, &Backend::sigPostPublished, this, &PostEntry::slotPostPublished);
            if (d->isNewPost) {
                b->publishPost(&d->mCurrentPost);
            } else {
                b->modifyPost(&d->mCurrentPost);
            }
        } else {
            deleteProgressBar();
        }
    }
    delete dia;
}
예제 #7
0
void KWQTableView::doPrintPreview()
{
  QPrinter printer;
  QPointer<KPrintPreview> preview = new KPrintPreview(&printer, this);
  QTextDocument td;
  createPages(&printer, &td, true);
  preview->exec();
  delete preview;
}
예제 #8
0
void MarbleWidget::creatingTilesStart( TileCreator *creator,
                                       const QString &name, 
                                       const QString &description )
{
    QPointer<TileCreatorDialog> dialog = new TileCreatorDialog( creator, this );
    dialog->setSummary( name, description );
    dialog->exec();
    delete dialog;
}
예제 #9
0
void KrBookmarkHandler::bookmarkCurrent(QUrl url)
{
    QPointer<KrAddBookmarkDlg> dlg = new KrAddBookmarkDlg(_mainWindow->widget(), url);
    if (dlg->exec() == QDialog::Accepted) {
        KrBookmark *bm = new KrBookmark(dlg->name(), dlg->url(), _collection);
        addBookmark(bm, dlg->folder());
    }
    delete dlg;
}
예제 #10
0
IccTransform IccPostLoadingManager::postLoadingManage(QWidget* const parent)
{
    if (image().hasAttribute(QLatin1String("missingProfileAskUser")))
    {
        image().removeAttribute(QLatin1String("missingProfileAskUser"));
        DImg preview                     = image().smoothScale(240, 180, Qt::KeepAspectRatio);
        QPointer<ColorCorrectionDlg> dlg = new ColorCorrectionDlg(ColorCorrectionDlg::MissingProfile, preview,
                                                                  m_filePath, parent);
        dlg->exec();

        IccTransform trans;
        getTransform(trans, dlg->behavior(), dlg->specifiedProfile());
        delete dlg;
        return trans;
    }
    else if (image().hasAttribute(QLatin1String("profileMismatchAskUser")))
    {
        image().removeAttribute(QLatin1String("profileMismatchAskUser"));
        DImg preview                     = image().smoothScale(240, 180, Qt::KeepAspectRatio);
        QPointer<ColorCorrectionDlg> dlg = new ColorCorrectionDlg(ColorCorrectionDlg::ProfileMismatch, preview,
                                                                  m_filePath, parent);
        dlg->exec();

        IccTransform trans;
        getTransform(trans, dlg->behavior(), dlg->specifiedProfile());
        delete dlg;
        return trans;
    }
    else if (image().hasAttribute(QLatin1String("uncalibratedColorAskUser")))
    {
        image().removeAttribute(QLatin1String("uncalibratedColorAskUser"));
        DImg preview                     = image().smoothScale(240, 180, Qt::KeepAspectRatio);
        QPointer<ColorCorrectionDlg> dlg = new ColorCorrectionDlg(ColorCorrectionDlg::UncalibratedColor, preview,
                                                                  m_filePath, parent);
        dlg->exec();

        IccTransform trans;
        getTransform(trans, dlg->behavior(), dlg->specifiedProfile());
        delete dlg;
        return trans;
    }

    return IccTransform();
}
예제 #11
0
void MainWindow::checkForFileChanges(const FileCheckMoment &moment)
{
	if (moment == FocusIn)
	{
		QDateTime lastExternalModifiedDateTime(QFileInfo(m_currentUrl.path()).lastModified());
		if (lastExternalModifiedDateTime > m_lastInternalModifiedDateTime)
			m_isModifiedExternally = true;
		else // when the fileChangedWarningMessageBox below is cancelled, the main window is focused in again with m_isModifiedExternally == true so this slot is called again, but now m_lastInternalModifiedDateTime has been updated (during focusOut) and now we don't want to show the dialog again
			return;
	}

	if (!m_isModifiedExternally)
		return;

	m_isModifiedExternally = false;
	QPointer<QMessageBox> fileChangedWarningMessageBox = new QMessageBox(this);
	fileChangedWarningMessageBox->setText(tr("The document was modified by another program.\nWhat do you want to do?"));
	fileChangedWarningMessageBox->setWindowTitle(KtikzApplication::applicationName());
	fileChangedWarningMessageBox->setIcon(QMessageBox::Warning);
	QAbstractButton *overwriteButton = fileChangedWarningMessageBox->addButton(tr("&Overwrite"), QMessageBox::AcceptRole);
	QAbstractButton *reloadButton;
	switch (moment)
	{
		case Saving:
			reloadButton = fileChangedWarningMessageBox->addButton(tr("&Save under another name"), QMessageBox::AcceptRole);
			break;
		case Closing:
			reloadButton = fileChangedWarningMessageBox->addButton(tr("&Close without saving"), QMessageBox::AcceptRole);
			break;
		case FocusIn:
		default:
			reloadButton = fileChangedWarningMessageBox->addButton(tr("&Reload file"), QMessageBox::AcceptRole);
			break;
	}
	fileChangedWarningMessageBox->addButton(QMessageBox::Cancel);
	fileChangedWarningMessageBox->exec();
	if (fileChangedWarningMessageBox->clickedButton() == overwriteButton)
		saveUrl(m_currentUrl);
	else if (fileChangedWarningMessageBox->clickedButton() == reloadButton)
		switch (moment)
		{
			case Saving:
				saveAs();
				break;
			case Closing:
				// do nothing since the file will be closed anyway
				break;
			case FocusIn:
			default:
				reload();
				break;
		}
	else // cancel (check again on "Save" or "Close")
		m_isModifiedExternally = true;
	delete fileChangedWarningMessageBox;
}
예제 #12
0
void TabBar::mouseMoveEvent (QMouseEvent *event)
{
    if (!dragStartPosition_.isNull()
        && (event->pos() - dragStartPosition_).manhattanLength() >= QApplication::startDragDistance())
    {
      dragStarted_ = true;
    }

    /* since Wayland has a serious issue related to QDrag that interferes with
       dropping tabs outside all windows, we don't enable tab DND without X11 */
    if (!noTabDND_
        && (event->buttons() & Qt::LeftButton)
        && dragStarted_
        && !window()->geometry().contains (event->globalPos()))
    {
        int index = currentIndex();
        if (index == -1)
        {
            event->accept();
            return;
        }

        QPointer<QDrag> drag = new QDrag (this);
        QMimeData *mimeData = new QMimeData;
        QByteArray array;
        array.append (QString ("%1+%2").arg (window()->winId()).arg (index));
        mimeData->setData ("application/featherpad-tab", array);
        drag->setMimeData (mimeData);
        QPixmap px = QIcon (":icons/tab.svg").pixmap (22, 22);
        drag->setPixmap (px);
        drag->setHotSpot (QPoint (px.width()/2, px.height()));
        Qt::DropAction dragged = drag->exec (Qt::MoveAction);
        if (dragged != Qt::MoveAction)
        {
            /* A tab is dropped outside all windows. WARNING: Under Enlightenment,
               this may be Qt::CopyAction, not IgnoreAction (an E bug). */
            if (count() > 1)
                emit tabDetached();
            else
                finishMouseMoveEvent();
            event->accept();
        }
        else // a tab is dropped into another window
            event->accept();
        drag->deleteLater();
    }
    else
    {
        QTabBar::mouseMoveEvent(event);
        int index = tabAt (event->pos());
        if (index > -1)
            QToolTip::showText (event->globalPos(), tabToolTip (index));
        else
            QToolTip::hideText();
    }
}
예제 #13
0
파일: umlrole.cpp 프로젝트: KDE/umbrello
/**
 * Display the properties configuration dialog for the object.
 *
 * @param parent    The parent widget.
 * @return  True for success of this operation.
 */
bool UMLRole::showPropertiesDialog(QWidget *parent)
{
    QPointer<UMLRoleDialog> dlg = new UMLRoleDialog(parent, this);
    bool modified = false;
    if (dlg->exec() == QDialog::Accepted) {
        modified = true;
    }
    delete dlg;
    return modified;
}
예제 #14
0
void ContactEditorMainWindow::slotConfigure()
{
    QPointer<ContactConfigureDialog> dialog = new ContactConfigureDialog(this);
    if (dialog->exec()) {
        if (mContactEditor) {
            mContactEditor->reloadConfig();
        }
    }
    delete dialog;
}
예제 #15
0
void LightscreenWindow::showOptions()
{
    mGlobalHotkeys->unregisterAllHotkeys();
    QPointer<OptionsDialog> optionsDialog = new OptionsDialog(this);

    optionsDialog->exec();
    optionsDialog->deleteLater();

    applySettings();
}
void GalleryWindow::slotSettings()
{
    // TODO: reload albumlist if OK slot used.
    QPointer<GalleryEdit> dlg = new GalleryEdit(kapp->activeWindow(), mpGallery, i18n("Edit Gallery Data") );
    if( dlg->exec() == QDialog::Accepted )
    {
        slotDoLogin();
    }
    delete dlg;
}
예제 #17
0
파일: umlview.cpp 프로젝트: Nephos/umbrello
/**
 * Shows the properties dialog for the view.
 */
bool UMLView::showPropertiesDialog(QWidget *parent)
{
    bool success = false;
    QPointer<UMLViewDialog> dlg = new UMLViewDialog(parent, umlScene());
    if (dlg->exec() == QDialog::Accepted) {
        success = true;
    }
    delete dlg;
    return success;
}
예제 #18
0
void ThumbnailPicker::slotEditImage() {
    QPointer<ThumbnailEditor> te = new ThumbnailEditor( this, wid, ht );
    if ( te->exec() == QDialog::Accepted ) {
        QPixmap pm = te->thumbnail();
        *Image = pm;
        ui->CurrentImage->setPixmap( pm );
        ui->CurrentImage->update();
    }
    delete te;
}
void FlickrWindow::slotCreateNewPhotoSet()
{
    /* This method is called when the photo set creation button is pressed. It
     * summons a creation dialog for user input. When that is closed, it
     * creates a new photo set in the local list. The id gets the form of
     * UNDEFINED_ followed by a number, to indicate that it doesn't exist on
     * Flickr yet. */

    // Call the dialog
    QPointer<FlickrNewPhotoSetDialog> dlg = new FlickrNewPhotoSetDialog(kapp->activeWindow());
    int resp = dlg->exec();

    if ((resp == QDialog::Accepted) && (!dlg->titleEdit->text().isEmpty()))
    {
        // Create a new photoset with title and description from the dialog.
        FPhotoSet fps;
        fps.title       = dlg->titleEdit->text();
        fps.description = dlg->descriptionEdit->toPlainText();

        // Lets find an UNDEFINED_ style id that isn't taken yet.s
        QString id;
        int i                               = 0;
        id                                  = "UNDEFINED_" + QString::number(i);
        QLinkedList<FPhotoSet>::iterator it = m_talker->m_photoSetsList->begin();

        while (it != m_talker->m_photoSetsList->end())
        {
            FPhotoSet fps = *it;

            if (fps.id == id)
            {
                id = "UNDEFINED_" + QString::number(++i);
                it = m_talker->m_photoSetsList->begin();
            }

            ++it;
        }

        fps.id = id;

        kDebug() << "Created new photoset with temporary id " << id;
        // Append the new photoset to the list.
        m_talker->m_photoSetsList->prepend(fps);
        m_talker->m_selectedPhotoSet = fps;

        // Re-populate the photo sets combo box.
        slotPopulatePhotoSetComboBox();
    }
    else
    {
        kDebug() << "New Photoset creation aborted ";
    }

    delete dlg;
}
void BatchProcessImagesDialog::slotPreviewFinished()
{
    if (m_PreviewProc->exitStatus() == QProcess::CrashExit)
    {
        KMessageBox::error(this, i18n("Cannot run properly 'convert' program from 'ImageMagick' package."));
        m_ui->m_previewButton->setEnabled(true);
        return;
    }

    BatchProcessImagesItem* item = static_cast<BatchProcessImagesItem*>(m_listFiles->currentItem());
    int ValRet                   = m_PreviewProc->exitCode();

    kDebug() << "Convert exit (" << ValRet << ")";

    if (ValRet == 0)
    {
        QString cropTitle = "";

        if (m_ui->m_smallPreview->isChecked())
            cropTitle = i18n(" - small preview");

        QPointer<ImagePreview> previewDialog = new ImagePreview(item->pathSrc(), m_tmpFolder + '/'
                + QString::number(getpid()) + "preview.PNG", m_ui->m_smallPreview->isChecked(),
                m_Type->currentText() + cropTitle, item->nameSrc(), this);
        previewDialog->exec();
        delete previewDialog;

        KUrl deletePreviewImage(m_tmpFolder + '/' + QString::number(getpid()) + "preview.PNG");

        KIO::NetAccess::del(deletePreviewImage, kapp->activeWindow());
    }
    else
    {
        QPointer<KPOutputDialog> infoDialog = new KPOutputDialog(this, i18n("Preview processing error"),
                m_previewOutput, i18n("Cannot process preview for image \"%1\"."
                                      "\nThe output messages are:\n", item->nameSrc()));
        infoDialog->exec();
        delete infoDialog;
    }

    endPreview();
}
예제 #21
0
파일: kggeneral.cpp 프로젝트: KDE/krusader
void KgGeneral::slotFindTools()
{
    QPointer<KrResultTableDialog> dlg = new KrResultTableDialog(this,
            KrResultTableDialog::Tool,
            i18n("Search results"),
            i18n("Searching for tools..."),
            "tools-wizard",
            i18n("Make sure to install new tools in your <code>$PATH</code> (e.g. /usr/bin)"));
    dlg->exec();
    delete dlg;
}
예제 #22
0
파일: csv_xxport.cpp 프로젝트: KDE/kdepim
ContactList CsvXXPort::importContacts() const
{
    ContactList contactList;
    QPointer<CSVImportDialog> dlg = new CSVImportDialog(parentWidget());
    if (dlg->exec() && dlg) {
        contactList.setAddressList(dlg->contacts());
    }

    delete dlg;
    return contactList;
}
예제 #23
0
/**
 * Reimplemented from UMLWidget::showPropertiesDialog to show a
 * properties dialog for an ActivityWidget.
 */
void ActivityWidget::showPropertiesDialog()
{
    UMLApp::app()->docWindow()->updateDocumentation(false);

    QPointer<ActivityDialog> dialog = new ActivityDialog(umlScene()->activeView(), this);
    if (dialog->exec() && dialog->getChangesMade()) {
        UMLApp::app()->docWindow()->showDocumentation(this, true);
        UMLApp::app()->document()->setModified(true);
    }
    delete dialog;
}
예제 #24
0
void
PartitionPage::editExistingPartition( Device* device, Partition* partition )
{
    QStringList mountPoints = getCurrentUsedMountpoints();
    mountPoints.removeOne( PartitionInfo::mountPoint( partition ) );

    QPointer<EditExistingPartitionDialog> dlg = new EditExistingPartitionDialog( device, partition, mountPoints, this );
    if ( dlg->exec() == QDialog::Accepted )
        dlg->applyChanges( m_core );
    delete dlg;
}
예제 #25
0
void TinyWebBrowser::print()
{
#ifndef QT_NO_PRINTER	
    QPrinter printer;

    QPointer<QPrintDialog> dlg = new QPrintDialog( &printer, this );
    if ( dlg->exec() )
        QWebView::print( &printer );
    delete dlg;
#endif
}
예제 #26
0
/**
 * Show a properties dialog for an ObjectWidget.
 */
void ObjectWidget::showPropertiesDialog()
{
    UMLApp::app()->docWindow()->updateDocumentation(false);
    QPointer<ClassPropertiesDialog> dlg = new ClassPropertiesDialog((QWidget*)UMLApp::app(), this);
    if (dlg->exec()) {
        UMLApp::app()->docWindow()->showDocumentation(this, true);
        UMLApp::app()->document()->setModified(true);
    }
    dlg->close();
    delete dlg;
}
예제 #27
0
void ControllerView::contextMenuEvent( QContextMenuEvent * )
{
	QPointer<CaptionMenu> contextMenu = new CaptionMenu( model()->displayName(), this );
	contextMenu->addAction( embed::getIconPixmap( "cancel" ),
						tr( "&Remove this controller" ),
						this, SLOT( deleteController() ) );
	contextMenu->addAction( tr("Re&name this controller"), this, SLOT( renameController() ));
	contextMenu->addSeparator();
	contextMenu->exec( QCursor::pos() );
	delete contextMenu;
}
예제 #28
0
void ImportMegaLinksDialog::on_bLocalFolder_clicked()
{
    QString defaultPath = ui->eLocalFolder->text().trimmed();
    if (!defaultPath.size())
    {
#ifdef WIN32
    #if QT_VERSION < 0x050000
        defaultPath = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation);
    #else
        defaultPath = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation)[0];
    #endif
#else
    #if QT_VERSION < 0x050000
        defaultPath = QDesktopServices::storageLocation(QDesktopServices::HomeLocation);
    #else
        defaultPath = QStandardPaths::standardLocations(QStandardPaths::HomeLocation)[0];
    #endif
#endif
    }

#ifndef _WIN32
    QPointer<MultiQFileDialog> dialog = new MultiQFileDialog(0,  tr("Select local folder"), defaultPath, false);
    dialog->setOptions(QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
    dialog->setFileMode(QFileDialog::DirectoryOnly);
    int result = dialog->exec();
    if (!dialog || result != QDialog::Accepted || dialog->selectedFiles().isEmpty())
    {
        delete dialog;
        return;
    }
    QString path = dialog->selectedFiles().value(0);
    delete dialog;
#else
    QString path = QFileDialog::getExistingDirectory(0,  tr("Select local folder"), defaultPath);
#endif
    if (path.length())
    {
        path = QDir::toNativeSeparators(path);
        QDir dir(path);
        if (!dir.exists() && !dir.mkpath(QString::fromAscii(".")))
        {
            return;
        }

        QTemporaryFile test(path + QDir::separator());
        if (!test.open())
        {
            QMessageBox::critical(window(), tr("Error"), tr("You don't have write permissions in this local folder."));
            return;
        }

        ui->eLocalFolder->setText(path);
    }
}
예제 #29
0
void PresentationAudioPage::slotSoundFilesButtonLoad()
{
    QPointer<QFileDialog> dlg = new QFileDialog(this, i18n("Load playlist"),
                                                QString(), i18n("Playlist (*.m3u)"));
    dlg->setAcceptMode(QFileDialog::AcceptOpen);
    dlg->setFileMode(QFileDialog::ExistingFile);

    if (dlg->exec() != QDialog::Accepted)
    {
        delete dlg;
        return;
    }

    QString filename = dlg->selectedFiles().isEmpty() ? QString() : dlg->selectedFiles().at(0);

    if (!filename.isEmpty())
    {
        QFile file(filename);

        if (file.open(QIODevice::ReadOnly|QIODevice::Text))
        {
            QTextStream in(&file);
            QList<QUrl> playlistFiles;

            while (!in.atEnd())
            {
                QString line = in.readLine();

                // we ignore the extended information of the m3u playlist file
                if (line.startsWith(QLatin1Char('#')) || line.isEmpty())
                    continue;

                QUrl fUrl(line);

                if (fUrl.isValid())
                {
                    if (fUrl.isLocalFile())
                    {
                        playlistFiles << fUrl;
                    }
                }
            }

            if (!playlistFiles.isEmpty())
            {
                m_SoundFilesListBox->clear();
                addItems(playlistFiles);
                updateFileList();
            }
        }
    }

    delete dlg;
}
예제 #30
0
void
PartitionPage::onNewVolumeGroupClicked()
{
    QString vgName;
    QVector< const Partition* > selectedPVs;
    qint64 peSize = 4;

    QVector< const Partition* > availablePVs;

    for ( const Partition* p : m_core->lvmPVs() )
        if ( !m_core->isInVG( p ) )
            availablePVs << p;

    QPointer< CreateVolumeGroupDialog > dlg = new CreateVolumeGroupDialog( vgName,
                                                                           selectedPVs,
                                                                           availablePVs,
                                                                           peSize,
                                                                           this );

    if ( dlg->exec() == QDialog::Accepted )
    {
        QModelIndex partitionIndex = m_ui->partitionTreeView->currentIndex();

        if ( partitionIndex.isValid() )
        {
            const PartitionModel* model = static_cast< const PartitionModel* >( partitionIndex.model() );
            Q_ASSERT( model );
            Partition* partition = model->partitionForIndex( partitionIndex );
            Q_ASSERT( partition );

            // Disable delete button if current partition was selected to be in VG
            // TODO: Should Calamares edit LVM PVs which are in VGs?
            if ( selectedPVs.contains( partition ) )
                m_ui->deleteButton->setEnabled( false );
        }

        QModelIndex deviceIndex = m_core->deviceModel()->index( m_ui->deviceComboBox->currentIndex(), 0 );
        Q_ASSERT( deviceIndex.isValid() );

        QVariant previousIndexDeviceData = m_core->deviceModel()->data( deviceIndex, Qt::ToolTipRole );

        // Creating new VG
        m_core->createVolumeGroup( vgName, selectedPVs, peSize );

        // As createVolumeGroup method call resets deviceModel,
        // is needed to set the current index in deviceComboBox as the previous one
        int previousIndex = m_ui->deviceComboBox->findData( previousIndexDeviceData, Qt::ToolTipRole );

        m_ui->deviceComboBox->setCurrentIndex( ( previousIndex < 0  ) ? 0 : previousIndex );
        updateFromCurrentDevice();
    }

    delete dlg;
}