~ubuntu-branches/ubuntu/oneiric/kde4libs/oneiric-proposed

« back to all changes in this revision

Viewing changes to solid/solid/backends/udisks/udisksdevice.cpp

  • Committer: Package Import Robot
  • Author(s): Philip Muškovac
  • Date: 2011-07-08 00:08:34 UTC
  • mto: This revision was merged to the branch mainline in revision 247.
  • Revision ID: package-import@ubuntu.com-20110708000834-dr9a8my4iml90qe5
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
    Copyright 2010 Michael Zanetti <mzanetti@kde.org>
3
 
    Copyright 2010 Lukas Tinkl <ltinkl@redhat.com>
 
3
    Copyright 2010-2011 Lukas Tinkl <ltinkl@redhat.com>
4
4
 
5
5
    This library is free software; you can redistribute it and/or
6
6
    modify it under the terms of the GNU Lesser General Public
287
287
            second = QObject::tr("/HD DVD-RW", "Second item of %1%2 Drive sentence");
288
288
 
289
289
        if (drive_is_hotpluggable)
290
 
            description = QObject::tr("External %1%2 Drive").arg(first).arg(second);
 
290
            description = QObject::tr("External %1%2 Drive", "%1 is CD-ROM/CD-R/etc; %2 is '/DVD-ROM'/'/DVD-R'/etc (with leading slash)").arg(first).arg(second);
291
291
        else
292
 
            description = QObject::tr("%1%2 Drive").arg(first).arg(second);
 
292
            description = QObject::tr("%1%2 Drive", "%1 is CD-ROM/CD-R/etc; %2 is '/DVD-ROM'/'/DVD-R'/etc (with leading slash)").arg(first).arg(second);
293
293
 
294
294
        return description;
295
295
    }
720
720
            prop("IdLabel").toString() == "System Reserved" ||
721
721
            ( prop("IdUsage").toString().isEmpty() && !prop("OpticalDiscIsBlank").toBool());
722
722
}
 
723
 
 
724
QString UDisksDevice::errorToString(const QString & error) const
 
725
{
 
726
    if (error == UD_ERROR_UNAUTHORIZED)
 
727
        return QObject::tr("You are not authorized to perform this operation.");
 
728
    else if (error == UD_ERROR_BUSY)
 
729
        return QObject::tr("The device is currently busy.");
 
730
    else if (error == UD_ERROR_FAILED)
 
731
        return QObject::tr("The requested operation has failed.");
 
732
    else if (error == UD_ERROR_CANCELED)
 
733
        return QObject::tr("The requested operation has been canceled.");
 
734
    else if (error == UD_ERROR_INVALID_OPTION)
 
735
        return QObject::tr("An invalid or malformed option has been given.");
 
736
    else if (error == UD_ERROR_MISSING_DRIVER)
 
737
        return QObject::tr("The kernel driver for this filesystem type is not available.");
 
738
    else
 
739
        return QObject::tr("An unspecified error has occurred.");
 
740
}
 
741
 
 
742
Solid::ErrorType UDisksDevice::errorToSolidError(const QString & error) const
 
743
{
 
744
    if (error == UD_ERROR_BUSY)
 
745
        return Solid::DeviceBusy;
 
746
    else if (error == UD_ERROR_FAILED)
 
747
        return Solid::OperationFailed;
 
748
    else if (error == UD_ERROR_CANCELED)
 
749
        return Solid::UserCanceled;
 
750
    else if (error == UD_ERROR_INVALID_OPTION)
 
751
        return Solid::InvalidOption;
 
752
    else if (error == UD_ERROR_MISSING_DRIVER)
 
753
        return Solid::MissingDriver;
 
754
    else
 
755
        return Solid::UnauthorizedOperation;
 
756
}