Index: src/java/org/jivesoftware/sparkimpl/plugin/filetransfer/transfer/Downloads.java
===================================================================
--- src/java/org/jivesoftware/sparkimpl/plugin/filetransfer/transfer/Downloads.java (revision 10832)
+++ src/java/org/jivesoftware/sparkimpl/plugin/filetransfer/transfer/Downloads.java (working copy)
@@ -13,9 +13,11 @@
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
+import java.awt.Desktop;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
+import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
@@ -73,7 +75,6 @@
private ImageIcon icon = SparkRes.getImageIcon("LEFT_ARROW_IMAGE");
private JButton backButton = new JButton(icon);
private JTextField path = new JTextField();
- private JButton renewExplorer;
private JPopupMenu popup = new JPopupMenu();
private JMenuItem mi_delete = new JMenuItem(Res.getString("menuitem.delete"));
@@ -146,25 +147,24 @@
String name = JOptionPane.showInputDialog(Res.getString("title.input.newname"), model.objects[table.getSelectedRow()][1]);
if(name != null)
{
- try
- {
- if(Spark.isLinux())
- rt.exec("mv " + model.objects[table.getSelectedRow()][1] + " " + name, null, dir);
- else
- {
- File file = new File(dir.getAbsolutePath() + "\\" + model.objects[table.getSelectedRow()][1]);
- boolean isFileRenamed = file.renameTo(new File(dir.getAbsolutePath() + "\\" + name));
- if(!isFileRenamed)
- {
- JOptionPane.showMessageDialog(dlg, Res.getString("title.error.rename.file"));
- }
- }
- updateTable();
- }
- catch (IOException e1)
- {
- JOptionPane.showMessageDialog(dlg, Res.getString("title.error.rename.file"));
- }
+ File file;
+ boolean isFileRenamed;
+ if(Spark.isWindows())
+ {
+ file = new File(dir.getAbsolutePath() + "\\" + model.objects[table.getSelectedRow()][1]);
+ isFileRenamed = file.renameTo(new File(dir.getAbsolutePath() + "\\" + name));
+ }
+ else
+ {
+ file = new File(dir.getAbsolutePath() + "/" + model.objects[table.getSelectedRow()][1]);
+ isFileRenamed = file.renameTo(new File(dir.getAbsolutePath() + "/" + name));
+ }
+ if(!isFileRenamed)
+ {
+ JOptionPane.showMessageDialog(dlg, Res.getString("title.error.rename.file"));
+ }
+
+ updateTable();
}
}
});
@@ -173,29 +173,27 @@
public void actionPerformed(ActionEvent e)
{
int loeschen = JOptionPane.showOptionDialog(dlg, Res.getString("title.delete.file"), "", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null);
- try
- {
- if(loeschen == 0)
+ if(loeschen == 0)
+ {
+ File file;
+ boolean isFileDeleted;
+ if(Spark.isWindows())
+ {
+ file = new File(dir.getAbsolutePath() + "\\" + model.objects[table.getSelectedRow()][1]);
+ isFileDeleted = file.delete();
+ }
+ else
+ {
+ file = new File(dir.getAbsolutePath() + "/" + model.objects[table.getSelectedRow()][1]);
+ isFileDeleted = file.delete();
+ }
+ if(!isFileDeleted)
{
- if(Spark.isLinux())
- rt.exec("rm -R " + model.objects[table.getSelectedRow()][1], null, dir);
- else
- {
- File file = new File(dir.getAbsolutePath() + "\\" + model.objects[table.getSelectedRow()][1]);
- boolean isFileDeleted = file.delete();
- if(!isFileDeleted)
- {
- JOptionPane.showMessageDialog(dlg, Res.getString("title.error.delete.file"));
- }
- }
+ JOptionPane.showMessageDialog(dlg, Res.getString("title.error.delete.file"));
}
- updateTable();
- }
- catch (IOException e1)
- {
- JOptionPane.showMessageDialog(dlg, Res.getString("title.error.delete.file"));
- }
- }
+ }
+ updateTable();
+ }
});
list.setLayout(new BorderLayout());
@@ -238,10 +236,6 @@
}
});
- renewExplorer = new JButton(Res.getString("button.unset.file.explorer"), SparkRes.getImageIcon(SparkRes.SMALL_DELETE));
- if(pref.getFileExplorer() == null || pref.getFileExplorer().equals(""))
- renewExplorer.setEnabled(false);
-
JLabel locationLabel = new JLabel(Res.getString("label.downloads"));
JButton userHomeButton = new JButton(Res.getString("title.downloads"), null);
@@ -270,8 +264,6 @@
mainPanel.add(locationLabel, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));
mainPanel.add(userHomeButton, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));
- mainPanel.add(renewExplorer, new GridBagConstraints(2, 4, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));
-
refreshTable.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
@@ -279,19 +271,6 @@
}
});
- renewExplorer.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- pref.setFileExplorer("");
- renewExplorer.setEnabled(false);
- }
- });
- if(Spark.isLinux())
- renewExplorer.setVisible(true);
- else
- {
- renewExplorer.setVisible(false);
- }
-
dlg.setVisible(true);
}
@@ -315,9 +294,14 @@
Runtime.getRuntime().exec("open " + downloadedFile.getCanonicalPath());
}
else if (!Spark.isMac()) {
- boolean couldOpenFile = SparkManager.getNativeManager().openFile(downloadedFile);
- if(!couldOpenFile)
- JOptionPane.showMessageDialog(dlg, Res.getString("title.error.couldnt.open.file"));
+ try
+ {
+ Desktop.getDesktop().open(downloadedFile);
+ }
+ catch (IOException e1)
+ {
+ JOptionPane.showMessageDialog(dlg, Res.getString("title.error.couldnt.open.file"));
+ }
}
}
catch (IOException e1) {
@@ -346,46 +330,7 @@
downloadedDir.mkdirs();
}
- if(!Spark.isLinux())
- openFile(downloadedDir);
- else if(Spark.isLinux())
- {
- try
- {
- String str;
- if(pref.getFileExplorer() == null || pref.getFileExplorer().equals(""))
- {
- str = JOptionPane.showInputDialog(Res.getString("title.input.fileexplorer"));
- if(str != null)
- {
- str = str.toLowerCase();
- pref.setFileExplorer(str);
- }
- }
-
- if(pref.getFileExplorer() == null || pref.getFileExplorer().equals(""));
- else
- {
- rt.exec(pref.getFileExplorer() + " " + downloadedDir);
- renewExplorer.setEnabled(true);
- }
- }
- catch (IOException e1)
- {
- JOptionPane.showMessageDialog(dlg, Res.getString("title.error.find.app") );
- pref.setFileExplorer("");
- renewExplorer.setEnabled(false);
- }
- /* try
- {
- Desktop.getDesktop().open(new File(pref.getDownloadDir()));
- }
- catch (IOException e1)
- {
- JOptionPane.showMessageDialog(dlg, "Der Dateimanager konnte nicht geöffnet werden!");
- }
- */
- }
+ openFile(downloadedDir);
}
public String filesize(File file)
@@ -476,51 +421,50 @@
table.addMouseListener(new MouseAdapter(){
public void mousePressed(MouseEvent e)
{
+ Point p = e.getPoint();
+ table.setRowSelectionInterval(table.rowAtPoint(p), table.rowAtPoint(p));
String name = (String)table.getValueAt(table.getSelectedRow(), 1);
- int index_files = 0;
- for(int i = 0; i < file.length; i++)
- {
- if(name.equals(file[i].getName()))
+ int index_files = 0;
+ for(int i = 0; i < file.length; i++)
{
- index_files = i;
- break;
+ if(name.equals(file[i].getName()))
+ {
+ index_files = i;
+ break;
+ }
}
- }
- if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 2)
- {
- if(file[index_files].isDirectory())
- {
- backButton.setEnabled(true);
- dir = new File(dir + "/" +file[index_files].getName());
- path.setText(dir.getAbsolutePath());
- updateTable();
- }
- else if(!file[index_files].isDirectory())
- {
- if(Spark.isLinux())
- mi_open();
- else
- openFile(file[index_files]);
- }
-
- }
- if ((e.getButton() == MouseEvent.BUTTON3)
- && table.getSelectedRow() != -1 && !file[index_files].isDirectory())
- {
- popup.setLocation(e.getX(), e.getY());
- popup.show(table, e.getX(), e.getY());
- }
- else
- popup.setVisible(false);
- }
- });
-
- table.setDefaultRenderer( Object.class, new Renderer() );
-
-
- table.add(popup);
- scroller.getViewport().add(table);
- addDownloadPanel(scroller);
+ if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 2)
+ {
+ if(file[index_files].isDirectory())
+ {
+ backButton.setEnabled(true);
+ dir = new File(dir + "/" +file[index_files].getName());
+ path.setText(dir.getAbsolutePath());
+ updateTable();
+ }
+ else if(!file[index_files].isDirectory())
+ {
+ openFile(file[index_files]);
+ }
+
+ }
+ if ((e.getButton() == MouseEvent.BUTTON3)
+ && table.getSelectedRow() != -1 && !file[index_files].isDirectory())
+ {
+ popup.setLocation(e.getX(), e.getY());
+ popup.show(table, e.getX(), e.getY());
+ }
+ else
+ popup.setVisible(false);
+ }
+ });
+
+ table.setDefaultRenderer( Object.class, new Renderer() );
+
+
+ table.add(popup);
+ scroller.getViewport().add(table);
+ addDownloadPanel(scroller);
}
public void updateTable()
@@ -538,6 +482,8 @@
model.fireTableDataChanged();
}
+
+
public void mi_open()
{
String str;
Index: src/plugins/sip/plugin.xml
===================================================================
--- src/plugins/sip/plugin.xml (revision 10807)
+++ src/plugins/sip/plugin.xml (working copy)
@@ -8,6 +8,6 @@
SIP Softphone Plugin
org.jivesoftware.sparkplugin.SoftPhonePlugin
2.5.0
- Windows,Mac
+ Windows,Mac,Linux