예제 #1
0
void MenuDiskItem::ejectButtonClicked()
{
    mDevice->unmount();
    setMountStatus(mDevice->isMounted());

    qobject_cast<QWidget*>(parent())->hide();
}
예제 #2
0
void MenuDiskItem::on_diskButton_clicked()
{
    qWarning() << "void MenuDiskItem::on_diskButton_clicked()" << m_info->path();
    bool success = m_info->mount();
    setMountStatus(success);
    if (success)
        QDesktopServices::openUrl(QUrl(m_info->path()));

    qobject_cast<QWidget*>(parent())->hide();
}
예제 #3
0
void MenuDiskItem::update()
{
    mDiskButton->setIcon(XdgIcon::fromTheme(QStringList()
                            << mDevice->iconName()
                            << "drive-removable-media-usb"
                        ));

    QString label = mDevice->label();
    mDiskButton->setText(label);

    setMountStatus(mDevice->isMounted());
}
예제 #4
0
void MenuDiskItem::update()
{
    if (mDevice.isValid())
    {
        const QIcon icon = XdgIcon::fromTheme(mDevice.icon(), QStringLiteral("drive-removable-media"));

        mDiskButton->setIcon(icon);
        mDiskButton->setText(mDevice.description());

        setMountStatus(mDevice.as<Solid::StorageAccess>()->isAccessible() || !opticalParent().udi().isEmpty());
    }
}
예제 #5
0
void MenuDiskItem::updateMountStatus()
{
    //Note: don't use the QStringLiteral here as it is causing a SEGFAULT in static finalization time
    //(the string is released upon our *.so removal, but the reference is still in held in libqtxdg...)
    static const QIcon icon = XdgIcon::fromTheme(mDevice.icon(), QLatin1String("drive-removable-media"));

    if (mDevice.isValid())
    {
        mDiskButton->setIcon(icon);
        mDiskButton->setText(mDevice.description());

        setMountStatus(mDevice.as<Solid::StorageAccess>()->isAccessible() || !opticalParent().udi().isEmpty());
    }
    else
        emit invalid(mDevice.udi());
}
예제 #6
0
MenuDiskItem::MenuDiskItem(UdisksInfo *info, QWidget *parent)
    : QWidget(parent),
      m_info(info)
{
    setupUi(this);
    
    eject->setIcon(XdgIcon::fromTheme("media-eject"));
    QString iconName(info->iconName());
    
    connect(info, SIGNAL(error(QString)),
            this, SIGNAL(error(QString)));

    if (!iconName.isEmpty())
        diskButton->setIcon(XdgIcon::fromTheme(iconName));
    else
        diskButton->setIcon(XdgIcon::fromTheme("drive-removable-media-usb"));

    setLabel(info->displayName() + " (" + info->fileSystem() + ")");

    setMountStatus(info->isMounted());
}
예제 #7
0
void MenuDiskItem::on_eject_clicked()
{
    qWarning() << "void MenuDiskItem::on_eject_clicked()" ;
    setMountStatus(!m_info->unmount());
    qobject_cast<QWidget*>(parent())->hide();
}