Commit 1c1b57a4 authored by Thiago H. S. Picharski's avatar Thiago H. S. Picharski

Merge remote branch 'le-device-notifier/master'

Signed-off-by: default avatarThiago H. S. Picharski <thsp08@c3sl.ufpr.br>
parents fb0e37d3 b125391f
Instructions to compile the source code:
1. Download and install the following packages:
- cmake
- libphonon-dev
- build-essential
- libplasma-dev
2. Create a folder called build and cd to:
mkdir build
cd build
3. Compile using the commands:
cmake ../src
make
#!/bin/bash
# gerar.sh
# Copyright (c) 2006 by Bruno Ribas <ribas@ufpr.br>
DIRTMP=$(mktemp -d)
VERSAO=$(cat VERSAO)
#arrumar versao
#$1 tipo de incremento
MAJOR=$(echo $VERSAO| cut -d'.' -f1)
MINOR=$(echo $VERSAO| cut -d'.' -f2)
REVISION=$(echo $VERSAO| cut -d'.' -f3)
case $1 in
Minor)
((MINOR++))
REVISION=0
;;
Major)
((MAJOR++))
MINOR=0
REVISION=0
;;
help)
echo "Uso: $0 Major|Minor|Revision"
echo ' Major - Altera versao Major'
echo ' Minor - Altera versao Minor'
exit
;;
*)
((REVISION++))
;;
esac
VERSAO="${MAJOR}.${MINOR}.${REVISION}"
echo "$VERSAO" > VERSAO
#Compila a documentacao do pacote no diretorio doc/
#cd doc/
#hevea -text *.tex
#hevea -text *.tex
#cd ../
cp -r pacote $DIRTMP
#Copia a documentacao compilada para dentro do pacote.
#cp doc/*.txt $DIRTMP/pacote/usr/share/doc/prd-*
cd $DIRTMP
find . -name ".svn" -exec rm -rf {} \; &>/dev/null
sed -i -e "s/Version:/Version: $VERSAO/" pacote/DEBIAN/control
fakeroot dpkg -b pacote .
cd -
cp $DIRTMP/*deb .
rm -rf $DIRTMP
# vim:tabstop=4:shiftwidth=4:encoding=iso-8859-1
Package: le-device-notifier
Section: main
Priority: important
Version:
Architecture: i386
Depends: le-interface | le-light-interface
Maintainer: LE Maintainer <le-maintainer@c3sl.ufpr.br>
Description: Device notifier for Linux Educacional
This is an adapted version of device-notifier-automount 0.4alpha1
created by Achim Strobelt.
#!/bin/bash
#
# Copyright (C) 2004-2011 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
#
# This file is part of le-device-notifier
#
# le-device-notifier is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
APPLETSRC=/etc/skel/.kde/share/config/plasma-desktop-appletsrc
sed -i s@"notifier"@"notifier_automount"@g ${APPLETSRC}
#!/bin/bash
#
# Copyright (C) 2004-2011 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
#
# This file is part of le-device-notifier
#
# le-device-notifier is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
# List of files to divert
divertList="
/usr/lib/kde4/plasma_applet_devicenotifier.so \
/usr/share/kde4/services/plasma-applet-devicenotifier.desktop \
"
# Divert files
if [[ "$1" != "upgrade" ]]; then
for file in $divertList; do
if test -e $file.real; then
rm -f $file
dpkg-divert --package le-device-notifier --remove --rename \
--divert $file{.real,}
fi
done
fi
#!/bin/bash
#
# Copyright (C) 2004-2011 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
#
# This file is part of le-device-notifier
#
# le-device-notifier is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
# List of files to divert
divertList="
/usr/lib/kde4/plasma_applet_devicenotifier.so \
/usr/share/kde4/services/plasma-applet-devicenotifier.desktop \
"
# Divert files
for file in $divertList; do
if test -f $file; then
dpkg-divert --package le-device-notifier --add --rename \
--divert $file{.real,}
fi
done
[Desktop Entry]
Name[en]=Device Notifier (Automount)
Name[de]=Geräteüberwachung (Automount)
Name=Notificador de Dispositivos (Montagem Automática)
Comment[en]=Notifications and access for new devices with automount
Comment[de]=Benachrichtigungen über neue Geräte und automatisches Einbinden
Comment=Notificação e acesso a novos dispositivos
Icon=device-notifier
Type=Service
X-KDE-ServiceTypes=Plasma/Applet
X-KDE-Library=plasma_applet_devicenotifier_automount
X-KDE-PluginInfo-Author=Achim Strobelt
X-KDE-PluginInfo-Email=mail@achimstrobelt.de
X-KDE-PluginInfo-Name=notifier_automount
X-KDE-PluginInfo-Version=0.4alpha1
X-KDE-PluginInfo-Website=http://www.kde-look.org/content/show.php?content=91517
X-KDE-PluginInfo-Category=System Information
X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=GPL
X-KDE-PluginInfo-EnabledByDefault=true
X-Plasma-Requires-FileDialog=Unused
X-Plasma-Requires-LaunchApp=Required
# Devicenotifier Automount 0.4alpha1
project(plasma-devicenotifier-automount)
# Find the required Libaries
find_package(KDE4 REQUIRED)
include(KDE4Defaults)
add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
include_directories(
${CMAKE_SOURCE_DIR}
${CMAKE_BINARY_DIR}
${KDE4_INCLUDES}
)
set(devicenotifier_automount_SRCS
devicenotifier_automount.cpp
notifierdialog_automount.cpp
notifierview_automount.cpp
automountGui_config.cpp
deviceoptions.cpp)
kde4_add_ui_files(devicenotifier_automount_SRCS devicenotifier_automountConfig.ui )
kde4_add_ui_files(devicenotifier_automount_SRCS devicenotifier_mountOptionsConfig.ui )
kde4_add_ui_files(devicenotifier_automount_SRCS automountGui_configDialog.ui )
kde4_add_plugin(plasma_applet_devicenotifier_automount ${devicenotifier_automount_SRCS} )
target_link_libraries(plasma_applet_devicenotifier_automount ${KDE4_PLASMA_LIBS} ${KDE4_KIO_LIBS} ${KDE4_SOLID_LIBS})
install(TARGETS plasma_applet_devicenotifier_automount DESTINATION ${PLUGIN_INSTALL_DIR})
install(FILES plasma-applet-devicenotifier_automount.desktop DESTINATION ${SERVICES_INSTALL_DIR})
install(FILES automountoptionsrc DESTINATION ${CONFIG_INSTALL_DIR})
/***************************************************************************
* Copyright (C) 2009 by Achim Strobelt <mail@achimstrobelt.de> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
***************************************************************************/
#include <KLocale>
#include <KMessageBox>
#include <KDebug>
// include the header file of the dialog
#include "automountGui_config.h"
AutomountConfigDialog::AutomountConfigDialog( const QStringList& fsOptions, const QString& fs, QWidget *parent )
: KDialog( parent )
{
QWidget *widget = new QWidget( this );
// create the user interface, the parent widget is "widget"
ui.setupUi(widget); // this is the important part
// temmporary fsOptions
QStringList tempOptions = fsOptions;
// set the widget with all its gui elements as the dialog's
// main widget
setMainWidget( widget );
// other KDialog options
setCaption( i18n("Mount options") + ": " + fs );
setButtons( KDialog::Close | KDialog::Ok );
// setup controls
ui.standardOptions->setTitle(i18n("Standard options"));
ui.uidBox->setText(i18n("User ID"));
if (tempOptions.contains("setUid=true")) {
ui.uidBox->setCheckState(Qt::Checked);
tempOptions.removeAll("setUid=true");
} else {
ui.uidBox->setCheckState(Qt::Unchecked);
}
ui.noexecBox->setText(i18n("Execute programs"));
if (tempOptions.contains("setNoexec=true"))
{
ui.noexecBox->setCheckState(Qt::Unchecked);
tempOptions.removeAll("setNoexec=true");
} else {
ui.noexecBox->setCheckState(Qt::Checked);
}
// Special options
ui.specialOptions->setTitle(i18n("Special options"));
ui.specialOptionsTable->clear();
QStringList headerLabels;
headerLabels << i18n("Option") << i18n("Value");
ui.specialOptionsTable->setHorizontalHeaderLabels(headerLabels);
ui.specialOptionsTable->setColumnCount(2);
ui.specialOptionsTable->setRowCount(tempOptions.count());
int row = 0;
QTableWidgetItem *newItem;
foreach (const QString &option, tempOptions) {
kDebug() << option;
if (option.contains("=")) {
QStringList optionList = option.split("=");
newItem = new QTableWidgetItem(optionList.takeFirst());
ui.specialOptionsTable->setItem(row, 0, newItem);
newItem = new QTableWidgetItem(optionList.takeFirst());
ui.specialOptionsTable->setItem(row, 1, newItem);
} else {
newItem = new QTableWidgetItem(option);
ui.specialOptionsTable->setItem(row, 0, newItem);
}
row++;
}
connect(ui.specialOptionsTable, SIGNAL(currentCellChanged(int , int, int, int)), this, SLOT(specialOptionsCellChanged()));
// Option buttons
ui.addOptionButton->setText(i18n("Add option"));
ui.addOptionButton->setIcon(KIcon("list-add"));
connect(ui.addOptionButton, SIGNAL(clicked()), this, SLOT(addNewOption()));
ui.removeOptionButton->setText(i18n("Remove option"));
ui.removeOptionButton->setIcon(KIcon("list-remove"));
ui.removeOptionButton->setEnabled(false);
connect(ui.removeOptionButton, SIGNAL(clicked()), this, SLOT(removeOption()));
}
AutomountConfigDialog::~AutomountConfigDialog(void)
{
}
void AutomountConfigDialog::addNewOption(void)
{
kDebug() << "Add new option";
int rowCount = ui.specialOptionsTable->rowCount();
ui.specialOptionsTable->setRowCount(rowCount + 1);
}
void AutomountConfigDialog::removeOption(void)
{
kDebug() << "Remove option";
if (ui.specialOptionsTable->currentRow() >= 0) {
ui.specialOptionsTable->removeRow(ui.specialOptionsTable->currentRow());
}
}
void AutomountConfigDialog::specialOptionsCellChanged(void)
{
kDebug() << "Current cell changed";
// After cell changed a cell is selected and the remove button can be enabled
ui.removeOptionButton->setEnabled(true);
}
QStringList AutomountConfigDialog::getFsOptions(void)
{
QStringList returnValue;
// set UID?
kDebug() << "UID";
if (ui.uidBox->checkState() == Qt::Checked) {
returnValue << "setUid=true";
}
// noexec?
kDebug() << "NoExec";
if (ui.noexecBox->checkState() == Qt::Unchecked) {
returnValue << "setNoexec=true";
}
// read special Options
for (int row = 0; row < ui.specialOptionsTable->rowCount(); row++) {
if (ui.specialOptionsTable->item(row, 0) != 0) {
if (ui.specialOptionsTable->item(row, 1) != 0) {
returnValue << ui.specialOptionsTable->item(row, 0)->text() + "=" + ui.specialOptionsTable->item(row, 1)->text();
} else {
returnValue << ui.specialOptionsTable->item(row, 0)->text();
}
}
}
return returnValue;
}
#include "automountGui_config.moc"
/***************************************************************************
* Copyright (C) 2009 by Achim Strobelt <mail@achimstrobelt.de> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
***************************************************************************/
#ifndef AUTOMOUNTGUI_CONFIG_H
#define AUTOMOUNTGUI_CONFIG_H
#include <KDialog>
// include the automatically generated header file for the ui-file
#include "ui_automountGui_configDialog.h"
class AutomountConfigDialog : public KDialog
{
Q_OBJECT
public:
AutomountConfigDialog( const QStringList& fsOptions, const QString& fs, QWidget *parent=0 );
~AutomountConfigDialog(void);
QStringList getFsOptions(void);
private slots:
void addNewOption(void);
void removeOption(void);
void specialOptionsCellChanged(void);
private:
// accessor to the ui. we can access all gui elements
// specified in Designer. If mydialog.ui contains a
// button "myButton", we will be able to access it
// with ui.myButton in the cpp file.
Ui::automountGui_configDialog ui;
};
#endif
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>automountGui_configDialog</class>
<widget class="QWidget" name="automountGui_configDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>490</width>
<height>536</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<property name="locale">
<locale language="English" country="UnitedStates"/>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QGroupBox" name="standardOptions">
<property name="title">
<string>standardOptions</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="uidBox">
<property name="text">
<string>uidBox</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="noexecBox">
<property name="text">
<string>noexecBox</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="specialOptions">
<property name="title">
<string>specialOptions</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" rowspan="3">
<widget class="QTableWidget" name="specialOptionsTable">
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
<property name="columnCount">
<number>2</number>
</property>
<column/>
<column/>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="addOptionButton">
<property name="text">
<string>addOptionButton</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="removeOptionButton">
<property name="text">
<string>removeOptionButton</string>
</property>
</widget>
</item>
<item row="2" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>42</width>
<height>354</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
[Devices]
Filesystems=iso9660,vfat,udf
iso9660=setNoexec=true,mode=0444
udf=
vfat=setUid=true,setNoexec=true,fmask=0133,dmask=0022
This diff is collapsed.
</
/***************************************************************************
* Copyright (C) 2007 by Alexis Ménard <darktears31@gmail.com> *
* Copyright (C) 2009 by Achim Strobelt <mail@achimstrobelt.de> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
***************************************************************************/
#ifndef DEVICENOTIFIER_H
#define DEVICENOTIFIER_H
//Solid
#include <solid/solidnamespace.h>
//Plasma
#include <Plasma/PopupApplet>
#include <Plasma/DataEngine>
#include <Plasma/ToolTipManager>
// User interface
#include "ui_devicenotifier_automountConfig.h"
#include "ui_devicenotifier_mountOptionsConfig.h"
#include "deviceoptions.h"
class QStandardItemModel;
class QGraphicsLinearLayout;
class QGraphicsProxyWidget;
class QTimer;
class KIcon;
namespace Notifier
{
class NotifierDialog;
}
//desktop view
namespace Plasma
{
class IconWidget;
}
/**
* @short Applet used to display hot plug devices
*
*/
class DeviceNotifier : public Plasma::PopupApplet
{
Q_OBJECT
public:
/**
* Constructor of the applet
* @param parent the parent of this object
**/
DeviceNotifier(QObject *parent, const QVariantList &args);
/**
* Default destructor
**/
~DeviceNotifier();
/**
* initialize the applet (called by plasma automatically)
**/
void init();
/**
* allow to change the icon of the notifier if this applet is in icon mode
**/
void changeNotifierIcon(const QString& name = QString());
/**
* The widget that displays the list of devices.
*/
QWidget *widget();
/**
* @internal get starting options for device
*/
QString getStartOptions(const QString &udi);
/**
* @internal mount device
*/
void mountDevice(const QString &name);
protected:
void popupEvent(bool show);
/**
* Configuration interface
*/
void createConfigurationInterface(KConfigDialog *parent);
public slots:
/**
* @internal Sets the tooltip content properly before showing.
*/
void toolTipAboutToShow();
/**
* @internal Clears memory when needed.
*/
void toolTipHidden();
protected slots:
/**
* slot called when a source/device is added in the hotplug engine
* @param name the name of the new source
**/
void onSourceAdded(const QString &name);
/**
* @internal slot called when a source/device is removed in the hotplug engine
* @param name the name of the removed source
**/
void onSourceRemoved(const QString &name);
/**
* slot called when a source of the hotplug engine is updated
* @param source the name of the source
* @param data the data of the source
**/
void dataUpdated(const QString &source, Plasma::DataEngine::Data data);
/**
* @internal slot called when the configuration dialog is accepted
**/
void configAccepted();
/**
* @internal slot called when the configuration dialog is rejected
**/
void configRejected();
/**