Skip to content

Commit

Permalink
Always use database file dir as fallback and remove preferences option
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan-kolb committed Jan 25, 2016
1 parent 64b848a commit 8825dd7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
2 changes: 0 additions & 2 deletions src/main/java/net/sf/jabref/JabRefPreferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,6 @@ public final class JabRefPreferences {
public static final String DB_CONNECT_HOSTNAME = "dbConnectHostname";
public static final String DB_CONNECT_SERVER_TYPE = "dbConnectServerType";
public static final String BIB_LOC_AS_PRIMARY_DIR = "bibLocAsPrimaryDir";
public static final String BIB_LOCATION_AS_FILE_DIR = "bibLocationAsFileDir";
public static final String SELECTED_FETCHER_INDEX = "selectedFetcherIndex";
public static final String WEB_SEARCH_VISIBLE = "webSearchVisible";
public static final String ALLOW_FILE_AUTO_OPEN_BROWSE = "allowFileAutoOpenBrowse";
Expand Down Expand Up @@ -744,7 +743,6 @@ private JabRefPreferences() {
defaults.put(ALLOW_FILE_AUTO_OPEN_BROWSE, Boolean.TRUE);
defaults.put(WEB_SEARCH_VISIBLE, Boolean.FALSE);
defaults.put(SELECTED_FETCHER_INDEX, 0);
defaults.put(BIB_LOCATION_AS_FILE_DIR, Boolean.TRUE);
defaults.put(BIB_LOC_AS_PRIMARY_DIR, Boolean.FALSE);
defaults.put(DB_CONNECT_SERVER_TYPE, "MySQL");
defaults.put(DB_CONNECT_HOSTNAME, "localhost");
Expand Down
11 changes: 6 additions & 5 deletions src/main/java/net/sf/jabref/MetaData.java
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public List<String> getFileDirectory(String fieldName) {
String key = Globals.prefs.get(JabRefPreferences.USER_FILE_DIR_INDIVIDUAL); // USER_SPECIFIC_FILE_DIR_FOR_DB
List<String> metaData = getData(key);
if (metaData == null) {
key = Globals.prefs.get(JabRefPreferences.USER_FILE_DIR); // FILE_DIR_FOR_DIR
key = Globals.prefs.get(JabRefPreferences.USER_FILE_DIR); // FILE_DIR_FOR_DB
metaData = getData(key);
}

Expand Down Expand Up @@ -212,13 +212,14 @@ public List<String> getFileDirectory(String fieldName) {
}
}

// 4. bib file directory TODO: remove these options?
if (Globals.prefs.getBoolean(JabRefPreferences.BIB_LOCATION_AS_FILE_DIR) && (getFile() != null)) {
// 4. bib file directory
if (getFile() != null) {
String parentDir = getFile().getParent();
// Check if we should add it as primary file dir (first in the list) or not:
if (Globals.prefs.getBoolean(JabRefPreferences.BIB_LOC_AS_PRIMARY_DIR)) {
fileDirs.add(0, getFile().getParent());
fileDirs.add(0, parentDir);
} else {
fileDirs.add(getFile().getParent());
fileDirs.add(parentDir);
}
}

Expand Down
2 changes: 0 additions & 2 deletions src/main/java/net/sf/jabref/gui/preftabs/ExternalTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@ public void actionPerformed(ActionEvent event) {
@Override
public void setValues() {
fileDir.setText(prefs.get(Globals.FILE_FIELD + Globals.DIR_SUFFIX));
bibLocationAsFileDir.setSelected(prefs.getBoolean(JabRefPreferences.BIB_LOCATION_AS_FILE_DIR));
bibLocAsPrimaryDir.setSelected(prefs.getBoolean(JabRefPreferences.BIB_LOC_AS_PRIMARY_DIR));
bibLocAsPrimaryDir.setEnabled(bibLocationAsFileDir.isSelected());
runAutoFileSearch.setSelected(prefs.getBoolean(JabRefPreferences.RUN_AUTOMATIC_FILE_SEARCH));
Expand Down Expand Up @@ -245,7 +244,6 @@ public void storeSettings() {

// We should maybe do some checking on the validity of the contents?
prefs.put(Globals.FILE_FIELD + Globals.DIR_SUFFIX, fileDir.getText());
prefs.putBoolean(JabRefPreferences.BIB_LOCATION_AS_FILE_DIR, bibLocationAsFileDir.isSelected());
prefs.putBoolean(JabRefPreferences.BIB_LOC_AS_PRIMARY_DIR, bibLocAsPrimaryDir.isSelected());
prefs.putBoolean(JabRefPreferences.AUTOLINK_EXACT_KEY_ONLY, matchExactKeyOnly.isSelected());
prefs.putBoolean(JabRefPreferences.RUN_AUTOMATIC_FILE_SEARCH, runAutoFileSearch.isSelected());
Expand Down

0 comments on commit 8825dd7

Please sign in to comment.