Ejemplo n.º 1
0
void RootMount::finish( int exitCode , QProcess::ExitStatus exitStatus )
{
    p->error_str = p->process->readAllStandardError();
    if( exitStatus == QProcess::CrashExit )
        p->error_str.append( "\nrootmount crashed" );

    QTest::qWait( 137 );
    read_mtab();

    while( !p->mounted.isEmpty() )
    {
        const QString & file = p->mounted.dequeue();

        if( isMount( file ) )
        {
            emit mounted( true );
        }
        else
        {
            emit mounted( false );
            p->error_str.append( "\n" + tr("Can't mount %1").arg(file) );
        }
    }

    while( !p->unmounted.isEmpty() )
    {
        const QString & file = p->unmounted.dequeue();

        if( !isMount( file ) )
        {
            emit unmounted( true );
        }
        else
        {
            emit unmounted( false );
            p->error_str.append( "\n" + tr("Can't unmount %1").arg(file) );
        }
    }

    emit finished( exitCode );

    if( !p->error_str.isEmpty() )
        emit error( p->error_str );

    if( p->queue.isEmpty() )
        dropProcess();
}
Ejemplo n.º 2
0
MenuDiskItem::MenuDiskItem(RazorMountDevice *device, QWidget *parent)
    : QWidget(parent),
      mDevice(device)
{
    setupUi(this);
    eject->setIcon(XdgIcon::fromTheme("media-eject"));

    connect(device, SIGNAL(destroyed()),
              this, SLOT(free()));

    connect(device, SIGNAL(changed()),
              this, SLOT(update()));

    connect(device, SIGNAL(mounted()),
              this, SLOT(mounted()));

    connect(device, SIGNAL(unmounted()),
              this, SLOT(unmounted()));

    update();
}
Ejemplo n.º 3
0
MenuDiskItem::MenuDiskItem(LxQt::MountDevice *device, QWidget *parent):
    QFrame(parent),
    mDevice(device)
{
    mDiskButton = new QToolButton(this);
    mDiskButton->setObjectName("DiskButton");
    mDiskButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    mDiskButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
    connect(mDiskButton, SIGNAL(clicked()), this, SLOT(diskButtonClicked()));

    mEjectButton =  new QToolButton(this);
    mEjectButton->setObjectName("EjectButton");
    connect(mEjectButton, SIGNAL(clicked()), this, SLOT(ejectButtonClicked()));

    QHBoxLayout *layout = new QHBoxLayout(this);
    layout->addWidget(mDiskButton);
    layout->addWidget(mEjectButton);
    this->setLayout(layout);

    layout->setMargin(0);
    layout->setSpacing(0);

    mEjectButton->setIcon(XdgIcon::fromTheme("media-eject"));

    connect(device, SIGNAL(destroyed()),
              this, SLOT(free()));

    connect(device, SIGNAL(changed()),
              this, SLOT(update()));

    connect(device, SIGNAL(mounted()),
              this, SLOT(mounted()));

    connect(device, SIGNAL(unmounted()),
              this, SLOT(unmounted()));

    update();
}
Ejemplo n.º 4
0
void MenuDiskItem::ejectButtonClicked()
{
    mEjectButtonClicked = true;
    Solid::StorageAccess* di = mDevice.as<Solid::StorageAccess>();
    if (di->isAccessible())
    {
        di->teardown();
    } else
    {
        unmounted(Solid::NoError, QString(), mDevice.udi());
    }

    qobject_cast<QWidget*>(parent())->hide();
}
Ejemplo n.º 5
0
void Mounter::onFinished(int exitCode, QProcess::ExitStatus exitStatus)
{
    if (exitStatus == QProcess::NormalExit)
    {
        qCDebug(KDECONNECT_PLUGIN_SFTP) << "Process finished (exit code: " << exitCode << ")";
        Q_EMIT unmounted();
    }
    else
    {
        qCDebug(KDECONNECT_PLUGIN_SFTP) << "Process failed (exit code:" << exitCode << ")";
        Q_EMIT failed(i18n("Error when accessing to filesystem"));
    }
    
    unmount();
}
Ejemplo n.º 6
0
bool UDiskMountDevice::unmount()
{
    if (!mIsMounted)
        return true;

    QList<QVariant> args;
    args << QVariant(QStringList());

    bool ret;
    ret = mDbus->callWithCallback("FilesystemUnmount", args, this,
//                             SLOT(dbusSuccess(QDBusMessage)),
                             SIGNAL(unmounted()),
                             SLOT(dbusError(QDBusError, QDBusMessage)));
    return ret;
}